Class CompositeByteArrayRelativeBase
java.lang.Object
org.apache.mina.util.byteaccess.CompositeByteArrayRelativeBase
- Direct Known Subclasses:
CompositeByteArrayRelativeReader, CompositeByteArrayRelativeWriter
Provides common functionality between the
CompositeByteArrayRelativeReader and
CompositeByteArrayRelativeWriter.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CompositeByteArrayThe underlyingCompositeByteArray.protected final ByteArray.CursorA cursor of the underlyingCompositeByteArray. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of CompositeByteArrayRelativeBase. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidMake aByteArrayavailable for access at the end of this object.protected abstract voidCalled whenever the cursor has passed from thecba's first component.final voidfree()Free all resources associated with this object.final intgetIndex()final intfinal booleanfinal intlast()order()
-
Field Details
-
cba
The underlyingCompositeByteArray. -
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 Details
-
CompositeByteArrayRelativeBase
Creates a new instance of CompositeByteArrayRelativeBase.- Parameters:
cba- TheCompositeByteArraythat will be the base for this class
-
-
Method Details
-
getRemaining
public final int getRemaining()- Returns:
- The number of remaining bytes
-
hasRemaining
public final boolean hasRemaining()- Returns:
TRUEif there are some more bytes
-
order
- Returns:
- The used byte order (little of big indian)
-
append
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).
-