Java ByteBuffer to Byte Array readBytes(byte[] dest, int offset, int length, ByteBuffer buffer)

Here you can find the source of readBytes(byte[] dest, int offset, int length, ByteBuffer buffer)

Description

read Bytes

License

Open Source License

Declaration

public static void readBytes(byte[] dest, int offset, int length, ByteBuffer buffer) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.nio.ByteBuffer;

public class Main {
    public static void readBytes(byte[] dest, int offset, int length, ByteBuffer buffer) throws IOException {
        buffer.get(dest, offset, length);
    }//from w ww .j a  v a 2s  . c o  m

    public static byte[] readBytes(int length, ByteBuffer buffer) throws IOException {
        byte[] bytes = new byte[length];
        buffer.get(bytes);
        return bytes;
    }
}

Related

  1. getBytes(MappedByteBuffer buffer, int pos, byte[] target)
  2. getBytesAtOffset(ByteBuffer buffer, int offset, int length)
  3. getBytesFromBuffer(ByteBuffer buffer, int len)
  4. getBytesFromByteBuffer(ByteBuffer byteBuffer)
  5. getBytesFromByteBuffer(Object obj)
  6. readBytes(SocketChannel socketChannel, ByteBuffer byteBuffer, int length)
  7. readBytesFromByteBuffer(ByteBuffer byteBuffer)
  8. readBytesNoLength(ByteBuffer logBuf, int size)
  9. readBytesWithShortLength(ByteBuffer bb)