public class SourceEagerSplitPacketAssembler extends Object implements SourceSplitPacketAssembler
SourceSplitPacketAssembler
. The split-packet is decoded on-the-fly and the partial packet is then placed into a pre-allocated buffer
whose size is determined based on the initial parameters provided by the incoming split-packet(s). The pre-allocated buffer can then
be used as soon as it is marked as completed. Make sure to call reset()
after consuming the buffer.Constructor and Description |
---|
SourceEagerSplitPacketAssembler(io.netty.channel.ChannelHandlerContext ctx)
Constructor for SourceEagerSplitPacketAssembler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(SourceQuerySplitPacket splitPacket)
Adds a
SourceQuerySplitPacket to the container. |
int |
count()
count.
|
List<io.netty.buffer.ByteBuf> |
dump()
Dump a snapshot of the current received packets.
|
io.netty.buffer.ByteBuf |
getBuffer()
getBuffer.
|
boolean |
isComplete()
isComplete.
|
int |
received()
received.
|
void |
reset()
Resets the container back to it's initial state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isProcessing
public SourceEagerSplitPacketAssembler(io.netty.channel.ChannelHandlerContext ctx)
Constructor for SourceEagerSplitPacketAssembler.
ctx
- a ChannelHandlerContext
objectpublic boolean add(SourceQuerySplitPacket splitPacket)
SourceQuerySplitPacket
to the container. Once an assembler is marked in a completed state, this method throws an IllegalStateException
indicating that it is no longer accepting new packets. SourceSplitPacketAssembler.reset()
should be calledadd
in interface SourceSplitPacketAssembler
splitPacket
- The split-packet to be added. Note that packets can arrive at different order,
as long as both the container and the split-packet are in a valid state, then calling this method should not fail.true
if after calling this method caused the assembler in completed state (all split-packets have been received), false
if not yet completed.public int received()
received.
received
in interface SourceSplitPacketAssembler
public boolean isComplete()
isComplete.
isComplete
in interface SourceSplitPacketAssembler
true
if the container is now in completed state (all packets have been received). false
if either the container has not
been initialized (not collecting) or if the container is not yet marked in a completed stateSourceSplitPacketAssembler.reset()
,
SourceSplitPacketAssembler.getBuffer()
public io.netty.buffer.ByteBuf getBuffer()
getBuffer.
getBuffer
in interface SourceSplitPacketAssembler
ByteBuf
containing the re-assembled packets.public int count()
count.
count
in interface SourceSplitPacketAssembler
public void reset()
reset
in interface SourceSplitPacketAssembler
SourceSplitPacketAssembler.isComplete()
public List<io.netty.buffer.ByteBuf> dump()
dump
in interface SourceSplitPacketAssembler
Map
containing the currently received packetsCopyright © 2016–2024. All rights reserved.