Class CompositeByteArray.CursorImpl
java.lang.Object
org.apache.mina.util.byteaccess.CompositeByteArray.CursorImpl
- All Implemented Interfaces:
ByteArray.Cursor, IoRelativeReader, IoRelativeWriter
- Enclosing class:
CompositeByteArray
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteArray.Cursorprivate intprivate ByteArrayList.Nodeprivate intprivate final CompositeByteArray.CursorListener -
Constructor Summary
ConstructorsConstructorDescriptionCursorImpl(int index) CursorImpl(int index, CompositeByteArray.CursorListener listener) CursorImpl(CompositeByteArray.CursorListener listener) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckBounds(int index, int accessSize) byteget()voidGets enough bytes to fill theIoBufferand advances the reader.chargetChar()doublefloatgetFloat()intgetIndex()intgetInt()longgetLong()intshortgetShort()booleanChecks if there are any remaining bytes that can be read.order()private voidprepareForAccess(int accessSize) voidput(byte b) Puts abyteand advances the reader.voidPuts enough bytes to fill theIoBufferand advances the reader.voidputChar(char c) Puts acharand advances the reader.voidputDouble(double d) Puts adoubleand advances the reader.voidputFloat(float f) Puts afloatand advances the reader.voidputInt(int i) Puts anintand advances the reader.voidputLong(long l) Puts alongand advances the reader.voidputShort(short s) Puts ashortand advances the reader.voidsetIndex(int index) Sets the current index of the cursor.voidskip(int length) Advances the reader by the given number of bytes.slice(int length)
-
Field Details
-
index
private int index -
listener
-
componentNode
-
componentIndex
private int componentIndex -
componentCursor
-
-
Constructor Details
-
CursorImpl
public CursorImpl() -
CursorImpl
public CursorImpl(int index) -
CursorImpl
-
CursorImpl
-
-
Method Details
-
getIndex
public int getIndex()- Specified by:
getIndexin interfaceByteArray.Cursor- Returns:
- the current index of the cursor.
-
setIndex
public void setIndex(int index) Sets the current index of the cursor. No bounds checking will occur until an access occurs.- Specified by:
setIndexin interfaceByteArray.Cursor- Parameters:
index- The current index to set
-
skip
public void skip(int length) Advances the reader by the given number of bytes.- Specified by:
skipin interfaceIoRelativeReader- Specified by:
skipin interfaceIoRelativeWriter- Parameters:
length- the number of bytes to skip
-
slice
- Specified by:
slicein interfaceIoRelativeReader- Parameters:
length- The number of bytes to get- Returns:
- an array with a view of part of this array.
-
order
- Specified by:
orderin interfaceIoRelativeReader- Specified by:
orderin interfaceIoRelativeWriter- Returns:
- the bytes' order
-
prepareForAccess
private void prepareForAccess(int accessSize) -
getRemaining
public int getRemaining()- Specified by:
getRemainingin interfaceByteArray.Cursor- Specified by:
getRemainingin interfaceIoRelativeReader- Specified by:
getRemainingin interfaceIoRelativeWriter- Returns:
- the number of remaining bytes that can be read.
-
hasRemaining
public boolean hasRemaining()Checks if there are any remaining bytes that can be read.- Specified by:
hasRemainingin interfaceByteArray.Cursor- Specified by:
hasRemainingin interfaceIoRelativeReader- Specified by:
hasRemainingin interfaceIoRelativeWriter- Returns:
trueif there are some remaining bytes in the buffer
-
get
public byte get()- Specified by:
getin interfaceByteArray.Cursor- Specified by:
getin interfaceIoRelativeReader- Returns:
- the
byteat the current position and advances the reader.
-
put
public void put(byte b) Puts abyteand advances the reader.- Specified by:
putin interfaceIoRelativeWriter- Parameters:
b- The byte to put
-
get
Gets enough bytes to fill theIoBufferand advances the reader.- Specified by:
getin interfaceByteArray.Cursor- Specified by:
getin interfaceIoRelativeReader- Parameters:
bb- The IoBuffer that will contain the read bytes
-
put
Puts enough bytes to fill theIoBufferand advances the reader.- Specified by:
putin interfaceIoRelativeWriter- Parameters:
bb- The bytes to put
-
getShort
public short getShort()- Specified by:
getShortin interfaceIoRelativeReader- Returns:
- a
shortand advances the reader.
-
putShort
public void putShort(short s) Puts ashortand advances the reader.- Specified by:
putShortin interfaceIoRelativeWriter- Parameters:
s- The short to put
-
getInt
public int getInt()- Specified by:
getIntin interfaceByteArray.Cursor- Specified by:
getIntin interfaceIoRelativeReader- Returns:
- an
intand advances the reader.
-
putInt
public void putInt(int i) Puts anintand advances the reader.- Specified by:
putIntin interfaceIoRelativeWriter- Parameters:
i- The int to put
-
getLong
public long getLong()- Specified by:
getLongin interfaceIoRelativeReader- Returns:
- a
longand advances the reader.
-
putLong
public void putLong(long l) Puts alongand advances the reader.- Specified by:
putLongin interfaceIoRelativeWriter- Parameters:
l- The long to put
-
getFloat
public float getFloat()- Specified by:
getFloatin interfaceIoRelativeReader- Returns:
- a
floatand advances the reader.
-
putFloat
public void putFloat(float f) Puts afloatand advances the reader.- Specified by:
putFloatin interfaceIoRelativeWriter- Parameters:
f- The float to put
-
getDouble
public double getDouble()- Specified by:
getDoublein interfaceIoRelativeReader- Returns:
- a
doubleand advances the reader.
-
putDouble
public void putDouble(double d) Puts adoubleand advances the reader.- Specified by:
putDoublein interfaceIoRelativeWriter- Parameters:
d- The double to put
-
getChar
public char getChar()- Specified by:
getCharin interfaceIoRelativeReader- Returns:
- a
charand advances the reader.
-
putChar
public void putChar(char c) Puts acharand advances the reader.- Specified by:
putCharin interfaceIoRelativeWriter- Parameters:
c- The char to put
-
checkBounds
private void checkBounds(int index, int accessSize)
-