public class SourceLazySplitPacketAssembler extends Object implements SourceSplitPacketAssembler
SourceSplitPacketAssembler
. Packets will only be re-assembled when getBuffer()
is
called and the expected number of packets have been received.Constructor and Description |
---|
SourceLazySplitPacketAssembler(io.netty.channel.ChannelHandlerContext ctx)
Constructor for SourceLazySplitPacketAssembler.
|
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 SourceLazySplitPacketAssembler(io.netty.channel.ChannelHandlerContext ctx)
Constructor for SourceLazySplitPacketAssembler.
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.