Interface ByteArray.Cursor
- All Superinterfaces:
IoRelativeReader, IoRelativeWriter
- All Known Implementing Classes:
BufferByteArray.CursorImpl, CompositeByteArray.CursorImpl
- Enclosing interface:
ByteArray
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 Summary
-
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:
getRemainingin interfaceIoRelativeReader- Specified by:
getRemainingin interfaceIoRelativeWriter- 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:
hasRemainingin interfaceIoRelativeReader- Specified by:
hasRemainingin interfaceIoRelativeWriter- Returns:
trueif there are some remaining bytes in the buffer
-
get
byte get()- Specified by:
getin interfaceIoRelativeReader- Returns:
- the
byteat the current position and advances the reader.
-
get
Gets enough bytes to fill theIoBufferand advances the reader.- Specified by:
getin interfaceIoRelativeReader- Parameters:
bb- The IoBuffer that will contain the read bytes
-
getInt
int getInt()- Specified by:
getIntin interfaceIoRelativeReader- Returns:
- an
intand advances the reader.
-