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. See MemoryMappedFile.bigEndianIterator() and MemoryMappedFile.littleEndianIterator().
  • Constructor Summary

    Constructors
    Constructor Description
    BufferIterator()  
  • Method Summary

    Modifier and Type Method Description
    abstract byte readByte()
    Returns the byte at the current position, and advances the current position one byte.
    abstract 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.
    abstract int readInt()
    Returns the 32-bit int at the current position, and advances the current position four bytes.
    abstract 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.
    abstract short readShort()
    Returns the 16-bit short at the current position, and advances the current position two bytes.
    abstract void seek​(int offset)
    Seeks to the absolute position offset, measured in bytes from the start.
    abstract void skip​(int byteCount)
    Skips forwards or backwards byteCount bytes from the current position.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BufferIterator

      public BufferIterator()
  • Method Details

    • seek

      public abstract void seek​(int offset)
      Seeks to the absolute position offset, measured in bytes from the start.
    • skip

      public abstract void skip​(int byteCount)
      Skips forwards or backwards byteCount bytes from the current position.
    • readByteArray

      public abstract 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.
    • 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)
      Copies intCount 32-bit ints from the current position into dst, starting at dstOffset, and advances the current position 4 * intCount bytes.
    • readShort

      public abstract short readShort()
      Returns the 16-bit short at the current position, and advances the current position two bytes.