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

ByteBuffergetIncreasingByteBuffer(int len)
get Increasing Byte Buffer
return getIncreasingByteBuffer(0, len);
StringgetIPv4String(ByteBuffer buffer)
get I Pv String
return (buffer.get() & 0xff) + "." + (buffer.get() & 0xff) + "." + (buffer.get() & 0xff) + "."
        + (buffer.get() & 0xff);
StringgetJagexString(ByteBuffer buf)
Gets a null-terminated string from the specified buffer, using a modified ISO-8859-1 character set.
StringBuilder bldr = new StringBuilder();
int b;
while ((b = (buf.get() & 0xFF)) != 0) {
    if (b >= 127 && b < 160) {
        char curChar = CHARACTERS[b - 128];
        if (curChar != 0) {
            bldr.append(curChar);
    } else {
        bldr.append((char) b);
return bldr.toString();
byte[]getJceBufArray(ByteBuffer buffer)
get Jce Buf Array
byte[] arrayOfByte = new byte[buffer.position()];
System.arraycopy(buffer.array(), 0, arrayOfByte, 0, arrayOfByte.length);
return arrayOfByte;
intgetLength(ByteBuffer buffer)
get Length
int i = ((int) buffer.get()) & 0xff;
if ((i & ~0x7F) == 0) {
    return i;
byte[] bytes = new byte[i & 0x7f];
buffer.get(bytes);
return new BigInteger(1, bytes).intValue();
shortgetLengthFromBuffer(ByteBuffer in)

Extracts the length field from an ICP buffer.

return in.getShort(OFFSET_SHORT_LENGTH);
ListgetListFromByteBuffer(ByteBuffer data, List classes)
list from ByteBuffer
return getListFromBytes(data.array(), classes);
intgetLTriad(ByteBuffer bb)
get L Triad
return (int) (bb.get() << 16 | bb.get() << 8 | bb.get());
doublegetMean(ByteBuffer simulationResults)
get Mean
double sum = 0.0;
int size = simulationResults.capacity() / 8;
simulationResults.rewind();
for (int i = 0; i < size; i++) {
    double f = simulationResults.getDouble();
    sum += f;
return (sum / size);
...
intgetMedium(ByteBuffer buffer)
Gets a 24-bit medium integer from the specified ByteBuffer s current position and increases the buffers position by 3.
return (buffer.getShort() & 0xFFFF) << 8 | buffer.get() & 0xFF;