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

bytegetProfileIdc(ByteBuffer spsBuffer)
get Profile Idc
return spsBuffer.get(0);
longgetQuickchatParam(ByteBuffer buf, int size)
Retrieves a quickchat parameter from the byte buffer
if (--size < 0 || size > 7) {
    throw new IllegalArgumentException();
long l = 0L;
for (int shift = 8 * size; shift >= 0; shift -= 8) {
    l |= ((long) buf.get() & 0xffL) << shift;
return l;
...
bytegetRel(ByteBuffer bb, int rel)
get Rel
return bb.get(bb.position() + rel);
intgetRemaining(ByteBuffer[] byteBuffers)
get Remaining
if (byteBuffers == null || byteBuffers.length == 0) {
    return 0;
int remaining = 0;
for (ByteBuffer byteBuffer : byteBuffers) {
    remaining += byteBuffer.remaining();
return remaining;
...
byte[]getRemainingArray(ByteBuffer buffer)
Creates the array of bytes containing the bytes from the position to the limit of the ByteBuffer .
if (buffer == null) {
    return new byte[0];
byte[] ret = new byte[buffer.remaining()];
if (buffer.hasArray()) {
    byte[] array = buffer.array();
    System.arraycopy(array, buffer.arrayOffset() + buffer.position(), ret, 0, ret.length);
} else {
...
intgetRepeatSequenceCount(ByteBuffer buffer, int limitCount)
get Repeat Sequence Count
int counter = 0;
int startPos = buffer.position();
byte lastOctet = buffer.get(startPos);
int currentPos = 0;
do {
    currentPos = startPos + counter;
    byte octet = buffer.get(currentPos);
    if (lastOctet != octet)
...
StringgetRSString(ByteBuffer buffer)
Reads RuneScape protocol string from the buffer.
byte data;
StringBuilder builder = new StringBuilder();
while ((data = buffer.get()) != 10) {
    builder.append((char) data);
return builder.toString();
bytegetSByte(ByteBuffer buffer)
get S Byte
assert (buffer.capacity() - buffer.position() >= 1);
return buffer.get();
intgetSequenceNumber(ByteBuffer chunk)
Get sequence number of a symmetric message
chunk.position(16);
return chunk.getInt();
intgetShiftedI32(final int bytesPerPixel, final ByteBuffer data, final boolean retainDataPos)
Returns shifted bytes from the given data at current position of maximal 4 bytesPerPixel .
if (bytesPerPixel <= 4) {
    int shiftedI32 = 0;
    if (retainDataPos) {
        final int offset = data.position();
        for (int i = 0; i < bytesPerPixel; i++) {
            shiftedI32 |= (0xff & data.get(offset + i)) << 8 * i;
    } else {
...