List of utility methods to do ByteBuffer Get
char[] | getChars(ByteBuffer buf, int off, int count) Returns a character array from the buffer. char[] chars = new char[count]; buf.position(off); for (int ii = 0; ii < count; ii++) chars[ii] = buf.getChar(); return chars; |
char | getCPCharacter(ByteBuffer buffer) get CP Character int read = buffer.get() & 0xff; if (read == 0) { throw new IllegalArgumentException( "Non cp1252 character 0x" + Integer.toString(read, 16) + " provided"); if (read >= 128 && read < 160) { char cpChar = CHARACTERS[read - 128]; if (cpChar == '\0') { ... |
int | getCrcChecksum(ByteBuffer buffer) Calculates the CRC32 checksum of the specified buffer. Checksum crc = new CRC32(); for (int i = 0; i < buffer.limit(); i++) { crc.update(buffer.get(i)); return (int) crc.getValue(); |
int | getCRLFCRLFIndex(ByteBuffer buffer) get CRLFCRLF Index int len = buffer.position(); int s = 0; for (int i = 0; i < len; i++) { switch (buffer.get(i)) { case '\r': switch (s) { case 0: s = 1; ... |
int | getCRLFIndex(ByteBuffer buffer) get CRLF Index int len = buffer.position(); int s = 0; for (int i = 0; i < len; i++) { switch (buffer.get(i)) { case '\r': s = 1; break; case '\n': ... |
String | getCRLFLine(ByteBuffer buf) get CRLF Line StringBuilder str = new StringBuilder(); byte b; while (buf.hasRemaining()) { b = buf.get(); if (b == '\r' && buf.get() == '\n') { return str.toString(); str.append((char) b); ... |
int | getData(ByteBuffer buf, int index, int size) Get the int value of the given channel sample using the given size. if (size == 1) { return buf.get(index) & 0xFFFFFFFF; } else if (size == 2) { return buf.getShort(index); } else if (size == 3) { return get24BitInt(buf.get(index), buf.get(index + 1), buf.get(index + 2), buf.order()); } else { return buf.getInt(index); ... |
byte[] | getDataFromBuffer(ByteBuffer b) get Data From Buffer int position = b.position(); byte[] data = new byte[position]; b.position(0); b.get(data, 0, data.length); return data; |
ByteBuffer | getDirectByteBuffer(ByteBuffer var0, boolean var1) get Direct Byte Buffer if (var0.isDirect()) { return var0; } else { ByteBuffer var2 = var1 ? getPooledBuffer(var0.capacity()) : ByteBuffer.allocateDirect(var0.capacity()); var2.order(var0.order()); var2.put(var0); var2.flip(); return var2; ... |
double | getDouble(ByteBuffer buffer) get Double assert (buffer.capacity() - buffer.position() >= 8); long[] data = new long[8]; data[7] = buffer.get(); data[6] = buffer.get(); data[5] = buffer.get(); data[4] = buffer.get(); data[3] = buffer.get(); data[2] = buffer.get(); ... |