public final class HeapBufferIterator extends BufferIterator
| Modifier and Type | Method and Description |
|---|---|
static BufferIterator |
iterator(byte[] buffer,
int offset,
int byteCount,
ByteOrder order)
Returns a new iterator over
buffer, starting at offset and continuing for
byteCount bytes. |
byte |
readByte()
Returns the byte at the current position, and advances the current position one byte.
|
void |
readByteArray(byte[] dst,
int dstOffset,
int byteCount)
Copies
byteCount bytes from the current position into dst, starting at
dstOffset, and advances the current position byteCount bytes. |
int |
readInt()
Returns the 32-bit int at the current position, and advances the current position four bytes.
|
void |
readIntArray(int[] dst,
int dstOffset,
int intCount)
Copies
intCount 32-bit ints from the current position into dst, starting at
dstOffset, and advances the current position 4 * intCount bytes. |
short |
readShort()
Returns the 16-bit short at the current position, and advances the current position two bytes.
|
void |
seek(int offset)
Seeks to the absolute position
offset, measured in bytes from the start. |
void |
skip(int byteCount)
Skips forwards or backwards
byteCount bytes from the current position. |
public void seek(int offset)
BufferIteratoroffset, measured in bytes from the start.seek in class BufferIteratorpublic void skip(int byteCount)
BufferIteratorbyteCount bytes from the current position.skip in class BufferIteratorpublic void readByteArray(byte[] dst,
int dstOffset,
int byteCount)
BufferIteratorbyteCount bytes from the current position into dst, starting at
dstOffset, and advances the current position byteCount bytes.readByteArray in class BufferIteratorpublic byte readByte()
BufferIteratorreadByte in class BufferIteratorpublic int readInt()
BufferIteratorreadInt in class BufferIteratorpublic void readIntArray(int[] dst,
int dstOffset,
int intCount)
BufferIteratorintCount 32-bit ints from the current position into dst, starting at
dstOffset, and advances the current position 4 * intCount bytes.readIntArray in class BufferIteratorpublic short readShort()
BufferIteratorreadShort in class BufferIteratorpublic static BufferIterator iterator(byte[] buffer, int offset, int byteCount, ByteOrder order)
buffer, starting at offset and continuing for
byteCount bytes. Items larger than a byte are interpreted using the given byte order.