Package org.apache.mina.util.byteaccess
Class BufferByteArray.CursorImpl
- java.lang.Object
-
- org.apache.mina.util.byteaccess.BufferByteArray.CursorImpl
-
- All Implemented Interfaces:
ByteArray.Cursor,IoRelativeReader,IoRelativeWriter
- Enclosing class:
- BufferByteArray
private class BufferByteArray.CursorImpl extends java.lang.Object implements ByteArray.Cursor
-
-
Field Summary
Fields Modifier and Type Field Description private intindex
-
Constructor Summary
Constructors Constructor Description CursorImpl()CursorImpl(int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byteget()voidget(IoBuffer bb)Gets enough bytes to fill theIoBufferand advances the reader.chargetChar()doublegetDouble()floatgetFloat()intgetIndex()intgetInt()longgetLong()intgetRemaining()shortgetShort()booleanhasRemaining()Checks if there are any remaining bytes that can be read.java.nio.ByteOrderorder()voidput(byte b)Puts abyteand advances the reader.voidput(IoBuffer bb)Puts 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.ByteArrayslice(int length)
-
-
-
Method Detail
-
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
-
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
public ByteArray slice(int length)
- Specified by:
slicein interfaceIoRelativeReader- Parameters:
length- The number of bytes to get- Returns:
- an array with a view of part of this array.
-
order
public java.nio.ByteOrder order()
- Specified by:
orderin interfaceIoRelativeReader- Specified by:
orderin interfaceIoRelativeWriter- Returns:
- the bytes' order
-
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
public void get(IoBuffer bb)
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
public void put(IoBuffer bb)
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
-
-