Package libcore.io
Class NioBufferIterator
java.lang.Object
libcore.io.BufferIterator
libcore.io.NioBufferIterator
public final class NioBufferIterator extends BufferIterator
Iterates over big- or little-endian bytes on the native heap.
See
MemoryMappedFile.bigEndianIterator() and MemoryMappedFile.littleEndianIterator().-
Method Summary
Modifier and Type Method Description bytereadByte()Returns the byte at the current position, and advances the current position one byte.voidreadByteArray(byte[] dst, int dstOffset, int byteCount)CopiesbyteCountbytes from the current position intodst, starting atdstOffset, and advances the current positionbyteCountbytes.intreadInt()Returns the 32-bit int at the current position, and advances the current position four bytes.voidreadIntArray(int[] dst, int dstOffset, int intCount)CopiesintCount32-bit ints from the current position intodst, starting atdstOffset, and advances the current position4 * intCountbytes.shortreadShort()Returns the 16-bit short at the current position, and advances the current position two bytes.voidseek(int offset)Seeks to the absolute positionoffset, measured in bytes from the start.voidskip(int byteCount)Skips forwards or backwardsbyteCountbytes from the current position.
-
Method Details
-
seek
public void seek(int offset)Description copied from class:BufferIteratorSeeks to the absolute positionoffset, measured in bytes from the start.- Specified by:
seekin classBufferIterator
-
skip
public void skip(int byteCount)Description copied from class:BufferIteratorSkips forwards or backwardsbyteCountbytes from the current position.- Specified by:
skipin classBufferIterator
-
readByteArray
public void readByteArray(byte[] dst, int dstOffset, int byteCount)Description copied from class:BufferIteratorCopiesbyteCountbytes from the current position intodst, starting atdstOffset, and advances the current positionbyteCountbytes.- Specified by:
readByteArrayin classBufferIterator
-
readByte
public byte readByte()Description copied from class:BufferIteratorReturns the byte at the current position, and advances the current position one byte.- Specified by:
readBytein classBufferIterator
-
readInt
public int readInt()Description copied from class:BufferIteratorReturns the 32-bit int at the current position, and advances the current position four bytes.- Specified by:
readIntin classBufferIterator
-
readIntArray
public void readIntArray(int[] dst, int dstOffset, int intCount)Description copied from class:BufferIteratorCopiesintCount32-bit ints from the current position intodst, starting atdstOffset, and advances the current position4 * intCountbytes.- Specified by:
readIntArrayin classBufferIterator
-
readShort
public short readShort()Description copied from class:BufferIteratorReturns the 16-bit short at the current position, and advances the current position two bytes.- Specified by:
readShortin classBufferIterator
-