Package org.apache.mina.util.byteaccess
Class CompositeByteArrayRelativeBase
- java.lang.Object
-
- org.apache.mina.util.byteaccess.CompositeByteArrayRelativeBase
-
- Direct Known Subclasses:
CompositeByteArrayRelativeReader,CompositeByteArrayRelativeWriter
abstract class CompositeByteArrayRelativeBase extends Object
Provides common functionality between theCompositeByteArrayRelativeReaderandCompositeByteArrayRelativeWriter.- Author:
- Apache MINA Project
-
-
Field Summary
Fields Modifier and Type Field Description protected CompositeByteArraycbaThe underlyingCompositeByteArray.protected ByteArray.CursorcursorA cursor of the underlyingCompositeByteArray.
-
Constructor Summary
Constructors Constructor Description CompositeByteArrayRelativeBase(CompositeByteArray cba)Creates a new instance of CompositeByteArrayRelativeBase.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidappend(ByteArray ba)Make aByteArrayavailable for access at the end of this object.protected abstract voidcursorPassedFirstComponent()Called whenever the cursor has passed from thecba's first component.voidfree()Free all resources associated with this object.intgetIndex()intgetRemaining()booleanhasRemaining()intlast()ByteOrderorder()
-
-
-
Field Detail
-
cba
protected final CompositeByteArray cba
The underlyingCompositeByteArray.
-
cursor
protected final ByteArray.Cursor cursor
A cursor of the underlyingCompositeByteArray. This cursor is never moved directly; its position only changes through calls to relative read or write methods.
-
-
Constructor Detail
-
CompositeByteArrayRelativeBase
public CompositeByteArrayRelativeBase(CompositeByteArray cba)
Creates a new instance of CompositeByteArrayRelativeBase.- Parameters:
cba- TheCompositeByteArraythat will be the base for this class
-
-
Method Detail
-
getRemaining
public final int getRemaining()
- Returns:
- The number of remaining bytes
-
hasRemaining
public final boolean hasRemaining()
- Returns:
TRUEif there are some more bytes
-
order
public ByteOrder order()
- Returns:
- The used byte order (little of big endian)
-
append
public final void append(ByteArray ba)
Make aByteArrayavailable for access at the end of this object.- Parameters:
ba- The ByteArray to append
-
free
public final void free()
Free all resources associated with this object.
-
getIndex
public final int getIndex()
- Returns:
- the index that will be used for the next access.
-
last
public final int last()
- Returns:
- the index after the last byte that can be accessed.
-
cursorPassedFirstComponent
protected abstract void cursorPassedFirstComponent()
Called whenever the cursor has passed from thecba's first component. As the first component is no longer used, this provides a good opportunity for subclasses to perform some action on it (such as freeing it).
-
-