public final class ByteBufferAccess extends Access<ByteBuffer>
| Modifier and Type | Field and Description |
|---|---|
static ByteBufferAccess |
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
ByteOrder |
byteOrder(ByteBuffer input)
The byte order in which all multi-byte
getXXX() reads from the given input
are performed. |
int |
getByte(ByteBuffer input,
long offset)
Reads a single byte at the given
offset in the byte sequence represented by the given
input, returned widened to int. |
int |
getInt(ByteBuffer input,
long offset)
Reads
[offset, offset + 3] bytes of the byte sequence represented by the given
input as a single int value. |
long |
getLong(ByteBuffer input,
long offset)
Reads
[offset, offset + 7] bytes of the byte sequence represented by the given
input as a single long value. |
int |
getShort(ByteBuffer input,
long offset)
Reads
[offset, offset + 1] bytes of the byte sequence represented by the given
input as a single short value, returned widened to int. |
int |
getUnsignedByte(ByteBuffer input,
long offset)
Shortcut for
getByte(input, offset) & 0xFF. |
long |
getUnsignedInt(ByteBuffer input,
long offset)
Shortcut for
getInt(input, offset) & 0xFFFFFFFFL. |
int |
getUnsignedShort(ByteBuffer input,
long offset)
Shortcut for
getShort(input, offset) & 0xFFFF. |
protected Access<ByteBuffer> |
reverseAccess()
Get the
Access object with a different byte order. |
byteOrder, i16, i32, i64, i8, toByteBuffer, toCharSequence, toNativeCharSequence, u16, u32, u8, unsafepublic static final ByteBufferAccess INSTANCE
public long getLong(ByteBuffer input, long offset)
Access[offset, offset + 7] bytes of the byte sequence represented by the given
input as a single long value.getLong in class Access<ByteBuffer>input - the object to accessoffset - offset to the first byte to read within the byte sequence represented
by the given objectlong value, in the expected
orderpublic long getUnsignedInt(ByteBuffer input, long offset)
AccessgetInt(input, offset) & 0xFFFFFFFFL. Could be implemented more
efficiently.getUnsignedInt in class Access<ByteBuffer>input - the object to accessoffset - offset to the first byte to read within the byte sequence represented
by the given objectpublic int getInt(ByteBuffer input, long offset)
Access[offset, offset + 3] bytes of the byte sequence represented by the given
input as a single int value.getInt in class Access<ByteBuffer>input - the object to accessoffset - offset to the first byte to read within the byte sequence represented
by the given objectint value, in the expected
orderpublic int getUnsignedShort(ByteBuffer input, long offset)
AccessgetShort(input, offset) & 0xFFFF. Could be implemented more
efficiently.getUnsignedShort in class Access<ByteBuffer>input - the object to accessoffset - offset to the first byte to read within the byte sequence represented
by the given objectpublic int getShort(ByteBuffer input, long offset)
Access[offset, offset + 1] bytes of the byte sequence represented by the given
input as a single short value, returned widened to int.getShort in class Access<ByteBuffer>input - the object to accessoffset - offset to the first byte to read within the byte sequence represented
by the given objectshort value, in the expected
order, widened to intpublic int getUnsignedByte(ByteBuffer input, long offset)
AccessgetByte(input, offset) & 0xFF. Could be implemented more efficiently.getUnsignedByte in class Access<ByteBuffer>input - the object to accessoffset - offset to the byte to read within the byte sequence represented
by the given objectoffset, interpreted as unsignedpublic int getByte(ByteBuffer input, long offset)
Accessoffset in the byte sequence represented by the given
input, returned widened to int.getByte in class Access<ByteBuffer>input - the object to accessoffset - offset to the byte to read within the byte sequence represented
by the given objectoffset, widened to intpublic ByteOrder byteOrder(ByteBuffer input)
AccessgetXXX() reads from the given input
are performed.byteOrder in class Access<ByteBuffer>input - the accessed objectinputprotected Access<ByteBuffer> reverseAccess()
AccessAccess object with a different byte order. This method should
always return a fixed reference.reverseAccess in class Access<ByteBuffer>Copyright © 2014–2022. All rights reserved.