Package libcore.io
Class BufferIterator
- java.lang.Object
-
- libcore.io.BufferIterator
-
- Direct Known Subclasses:
HeapBufferIterator,NioBufferIterator
public abstract class BufferIterator extends Object
Iterates over big- or little-endian bytes. SeeMemoryMappedFile.bigEndianIterator()andMemoryMappedFile.littleEndianIterator().
-
-
Constructor Summary
Constructors Constructor Description BufferIterator()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract bytereadByte()Returns the byte at the current position, and advances the current position one byte.abstract voidreadByteArray(byte[] dst, int dstOffset, int byteCount)CopiesbyteCountbytes from the current position intodst, starting atdstOffset, and advances the current positionbyteCountbytes.abstract intreadInt()Returns the 32-bit int at the current position, and advances the current position four bytes.abstract voidreadIntArray(int[] dst, int dstOffset, int intCount)CopiesintCount32-bit ints from the current position intodst, starting atdstOffset, and advances the current position4 * intCountbytes.abstract shortreadShort()Returns the 16-bit short at the current position, and advances the current position two bytes.abstract voidseek(int offset)Seeks to the absolute positionoffset, measured in bytes from the start.abstract voidskip(int byteCount)Skips forwards or backwardsbyteCountbytes from the current position.
-
-
-
Method Detail
-
seek
public abstract void seek(int offset)
Seeks to the absolute positionoffset, measured in bytes from the start.
-
skip
public abstract void skip(int byteCount)
Skips forwards or backwardsbyteCountbytes from the current position.
-
readByteArray
public abstract void readByteArray(byte[] dst, int dstOffset, int byteCount)CopiesbyteCountbytes from the current position intodst, starting atdstOffset, and advances the current positionbyteCountbytes.
-
readByte
public abstract byte readByte()
Returns the byte at the current position, and advances the current position one byte.
-
readInt
public abstract int readInt()
Returns the 32-bit int at the current position, and advances the current position four bytes.
-
readIntArray
public abstract void readIntArray(int[] dst, int dstOffset, int intCount)CopiesintCount32-bit ints from the current position intodst, starting atdstOffset, and advances the current position4 * intCountbytes.
-
readShort
public abstract short readShort()
Returns the 16-bit short at the current position, and advances the current position two bytes.
-
-