Java Utililty Methods ByteBuffer Get

List of utility methods to do ByteBuffer Get

Description

The list of methods to do ByteBuffer Get are organized into topic(s).

Method

booleangetBoolean(ByteBuffer b)
get Boolean
return (b.getInt() == 1);
booleangetBoolean(ByteBuffer bb)
get Boolean
return bb.get() == 1;
booleangetBoolean(ByteBuffer bytes)
get Boolean
return bytes.slice().get() != 0;
booleangetBoolean(java.nio.ByteBuffer buffer)
get Boolean
return !((byte) 0 == buffer.get()); 
ByteBuffergetBuffer(ByteBuffer buffer, int len)
Get buffer form buffer
byte[] des = new byte[len];
buffer.get(des);
ByteBuffer buf = ByteBuffer.allocate(len);
buf.put(des);
buf.flip();
return buf;
byte[]getBufferBytes(ByteBuffer bb)
get Buffer Bytes
byte[] buffer = bb.array();
byte[] written = new byte[bb.position()];
for (int i = 0; i < written.length; i++) {
    written[i] = buffer[i];
return written;
shortgetByte(ByteBuffer bb)
Get an unsigned byte from the byte buffer.
return ((short) (bb.get() & 0xff));
shortgetByte(ByteBuffer byteBuffer)
get Byte
return (short) (byteBuffer.get() & BYTE_PADDING);
shortgetByteAsShort(java.nio.ByteBuffer buffer)
get Byte As Short
return (short) (0xFF & buffer.get());
intgetByteLen(ByteBuffer buffer)
get Byte Len
return 0xff & buffer.get();