Package org.apache.mina.util.byteaccess
Interface ByteArray.Cursor
-
- All Superinterfaces:
IoRelativeReader
,IoRelativeWriter
- 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 beCloneable
to allow cheap mark/position emulation?
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte
get()
void
get(IoBuffer bb)
Gets enough bytes to fill theIoBuffer
and advances the reader.int
getIndex()
int
getInt()
int
getRemaining()
boolean
hasRemaining()
Checks if there are any remaining bytes that can be read.void
setIndex(int index)
Sets the current index of the cursor.
-
-
-
Method Detail
-
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 interfaceIoRelativeReader
- Specified by:
getRemaining
in 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:
hasRemaining
in interfaceIoRelativeReader
- Specified by:
hasRemaining
in interfaceIoRelativeWriter
- Returns:
- true if there are some remaining bytes in the buffer
-
get
byte get()
- Specified by:
get
in interfaceIoRelativeReader
- Returns:
- the
byte
at the current position and advances the reader.
-
get
void get(IoBuffer bb)
Gets enough bytes to fill theIoBuffer
and advances the reader.- Specified by:
get
in interfaceIoRelativeReader
- Parameters:
bb
- The IoBuffer that will contain the read bytes
-
getInt
int getInt()
- Specified by:
getInt
in interfaceIoRelativeReader
- Returns:
- an
int
and advances the reader.
-
-