public class IndexPageDecoder extends Object implements IDecoder<byte[],byte[]>, IBaseDecoder<byte[],byte[]>
Constructor and Description |
---|
IndexPageDecoder(String host) |
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. |
void |
decode(ISession session,
byte[] data,
List<byte[]> out)
Decodes data from one type to another one.
|
Class<byte[]> |
getInboundType()
Returns the type of the accepted inbound objects.
|
Class<byte[]> |
getOutboundType()
Returns the type of the produced outbound objects.
|
public IndexPageDecoder(String host)
public Class<byte[]> getInboundType()
ICodec
getInboundType
in interface ICodec<byte[],byte[]>
public Class<byte[]> getOutboundType()
ICodec
getOutboundType
in interface ICodec<byte[],byte[]>
public int available(ISession session, ByteBuffer buffer, boolean flipped)
IBaseDecoder
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.
available
in interface IBaseDecoder<byte[],byte[]>
session
- the ISession
which the buffer belongs tobuffer
- the input buffer.flipped
- specifies the current mode of the bufferpublic int available(ISession session, byte[] buffer, int off, int len)
IBaseDecoder
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.
available
in interface IBaseDecoder<byte[],byte[]>
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 arraypublic void decode(ISession session, byte[] data, List<byte[]> out) throws Exception
IDecoder
Decoders that do not produce an output (i.e. the O parameter is
Void
) cannot change the object passed as the data
argument. They should not also store it for future use as its state can
be changed.
The above limitations regarding the data
argument do not apply to
decoders that produce an output.
Copyright © 2017–2022 SNF4J.ORG. All rights reserved.