I
- the type of the accepted inbound objects. It is expected that the
type should be either byte[]
or ByteBuffer
.O
- the type of the produced outbound objectspublic interface IBaseDecoder<I,O> extends IDecoder<I,O>
The special functionality (calling of the available
methods) of
this decoder will only work if this decoder is the first decoder in the
pipeline. Otherwise, it will work as a regular decoder.
Modifier and Type | Method and Description |
---|---|
int |
available(ISession session,
byte[] buffer,
int off,
int len)
Determines how many bytes should be read from the input buffer to create
the byte array that will be then passed to the
IDecoder.decode(org.snf4j.core.session.ISession, I, java.util.List<O>)
method. |
int |
available(ISession session,
ByteBuffer buffer,
boolean flipped)
Determines how many bytes should be read from the input buffer to create
the byte array that will be then passed to the
IDecoder.decode(org.snf4j.core.session.ISession, I, java.util.List<O>) method. |
getInboundType, getOutboundType
int available(ISession session, ByteBuffer buffer, boolean flipped)
IDecoder.decode(org.snf4j.core.session.ISession, I, java.util.List<O>)
method.
This method is called only if the input buffer is not backed by an array (i.e. a direct byte buffer allocator is used to create session's internal buffers).
The inner state of the passed buffer cannot be changed by this method.
session
- the ISession
which the buffer belongs tobuffer
- the input buffer.flipped
- specifies the current mode of the bufferint available(ISession session, byte[] buffer, int off, int len)
IDecoder.decode(org.snf4j.core.session.ISession, I, java.util.List<O>)
method.
This method is called only if the input buffer is backed by an array. (i.e. a heap byte buffer allocator is used to create session's internal buffers).
The content of the passed buffer cannot be changed by this method.
session
- the ISession
which the buffer belongs tobuffer
- the array that backs the input buffer.off
- the offset of the arraylen
- the number of the bytes in the arrayCopyright © 2017–2022 SNF4J.ORG. All rights reserved.