Interface ByteArray.Cursor

All Superinterfaces:
IoRelativeReader, IoRelativeWriter
All Known Implementing Classes:
BufferByteArray.CursorImpl, CompositeByteArray.CursorImpl
Enclosing interface:
ByteArray

public static interface ByteArray.Cursor extends IoRelativeReader, IoRelativeWriter
Provides relocatable, relative access to the underlying array. Multiple cursors may be used simultaneously, and cursors will stay consistent with the underlying array, even across modifications. Should this be Cloneable to allow cheap mark/position emulation?
  • Method Details

    • getIndex

      int getIndex()
      Returns:
      the current index of the cursor.
    • setIndex

      void setIndex(int index)
      Sets the current index of the cursor. No bounds checking will occur until an access occurs.
      Parameters:
      index - The current index to set
    • getRemaining

      int getRemaining()
      Specified by:
      getRemaining in interface IoRelativeReader
      Specified by:
      getRemaining in interface IoRelativeWriter
      Returns:
      the number of remaining bytes that can be read.
    • hasRemaining

      boolean hasRemaining()
      Checks if there are any remaining bytes that can be read.
      Specified by:
      hasRemaining in interface IoRelativeReader
      Specified by:
      hasRemaining in interface IoRelativeWriter
      Returns:
      true if there are some remaining bytes in the buffer
    • get

      byte get()
      Specified by:
      get in interface IoRelativeReader
      Returns:
      the byte at the current position and advances the reader.
    • get

      void get(IoBuffer bb)
      Gets enough bytes to fill the IoBuffer and advances the reader.
      Specified by:
      get in interface IoRelativeReader
      Parameters:
      bb - The IoBuffer that will contain the read bytes
    • getInt

      int getInt()
      Specified by:
      getInt in interface IoRelativeReader
      Returns:
      an int and advances the reader.