public interface BufferReader
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes(int index,
int count) |
double |
getDouble64(int index) |
float |
getFloat32(int index) |
short |
getInt16(int index)
Returns a signed 16-bit int calculated from two bytes of data at the specified index (MSB, LSB).
|
int |
getInt32(int index)
Returns a signed 32-bit integer from four bytes of data at the specified index the buffer.
|
long |
getInt64(int index)
Get a signed 64-bit integer from the buffer.
|
byte |
getInt8(int index)
Returns a signed 8-bit int calculated from one byte of data at the specified index.
|
long |
getLength()
Returns the length of the buffer.
|
java.lang.String |
getNullTerminatedString(int index,
int maxLengthBytes)
Creates a String from the _data buffer starting at the specified index,
and ending where
byte=='\0' or where length==maxLength . |
float |
getS15Fixed16(int index) |
java.lang.String |
getString(int index,
int bytesRequested) |
java.lang.String |
getString(int index,
int bytesRequested,
java.lang.String charset) |
int |
getUInt16(int index)
Returns an unsigned 16-bit int calculated from two bytes of data at the specified index.
|
long |
getUInt32(int index)
Get a 32-bit unsigned integer from the buffer, returning it as a long.
|
short |
getUInt8(int index)
Returns an unsigned 8-bit int calculated from one byte of data at the specified index.
|
boolean |
isMotorolaByteOrder()
Gets the endianness of this reader.
|
void |
setMotorolaByteOrder(boolean motorolaByteOrder)
Sets the endianness of this reader.
|
long getLength()
void setMotorolaByteOrder(boolean motorolaByteOrder)
true
for Motorola (or big) endiannessfalse
for Intel (or little) endiannessmotorolaByteOrder
- true
for motorola/big endian, false
for intel/little endianboolean isMotorolaByteOrder()
true
for Motorola (or big) endiannessfalse
for Intel (or little) endiannessshort getUInt8(int index) throws BufferBoundsException
index
- position within the data buffer to read byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativebyte getInt8(int index) throws BufferBoundsException
index
- position within the data buffer to read byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativeint getUInt16(int index) throws BufferBoundsException
index
- position within the data buffer to read first byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativeshort getInt16(int index) throws BufferBoundsException
index
- position within the data buffer to read first byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativelong getUInt32(int index) throws BufferBoundsException
index
- position within the data buffer to read first byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativeint getInt32(int index) throws BufferBoundsException
index
- position within the data buffer to read first byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativelong getInt64(int index) throws BufferBoundsException
index
- position within the data buffer to read first byteBufferBoundsException
- the buffer does not contain enough bytes to service the request, or index is negativefloat getS15Fixed16(int index) throws BufferBoundsException
BufferBoundsException
float getFloat32(int index) throws BufferBoundsException
BufferBoundsException
double getDouble64(int index) throws BufferBoundsException
BufferBoundsException
byte[] getBytes(int index, int count) throws BufferBoundsException
BufferBoundsException
java.lang.String getString(int index, int bytesRequested) throws BufferBoundsException
BufferBoundsException
java.lang.String getString(int index, int bytesRequested, java.lang.String charset) throws BufferBoundsException
BufferBoundsException
java.lang.String getNullTerminatedString(int index, int maxLengthBytes) throws BufferBoundsException
byte=='\0'
or where length==maxLength
.index
- The index within the buffer at which to start reading the string.maxLengthBytes
- The maximum number of bytes to read. If a zero-byte is not reached within this limit,
reading will stop and the string will be truncated to this length.BufferBoundsException
- The buffer does not contain enough bytes to satisfy this request.Copyright © 2002-2013 Drew Noakes. All Rights Reserved.