Package org.drasyl.handler.stream
Class ChunkedMessageInput
java.lang.Object
org.drasyl.handler.stream.ChunkedMessageInput
- All Implemented Interfaces:
io.netty.handler.stream.ChunkedInput<MessageChunk>
public class ChunkedMessageInput
extends Object
implements io.netty.handler.stream.ChunkedInput<MessageChunk>
Wraps each chunk of the specified
io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> into a series of sortable MessageChunks, allowing the receiver to reassemble the ByteBuf in correct order. Useful
for protocols that does provide message ordering (like UDP or drasyl).
ChannelPipelinep = ...; ... p.addLast("encoder", newMessageChunkEncoder()); p.addLast("chunked_write", newChunkedWriteHandler); p.addLast("decoder", newMessageChunkDecoder()); p.addLast("buffer", newMessageChunksBuffer(65536, 5000)); p.addLast("aggregator", newChunkedMessageAggregator(65536)); ... p.addLast("handler", new MyReassembledMessageHandler());
-
Constructor Summary
ConstructorsConstructorDescriptionChunkedMessageInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input) -
Method Summary
-
Constructor Details
-
ChunkedMessageInput
public ChunkedMessageInput(io.netty.handler.stream.ChunkedInput<io.netty.buffer.ByteBuf> input)
-
-
Method Details
-
isEndOfInput
- Specified by:
isEndOfInputin interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>- Throws:
Exception
-
close
- Specified by:
closein interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>- Throws:
Exception
-
readChunk
- Specified by:
readChunkin interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>- Throws:
Exception
-
readChunk
- Specified by:
readChunkin interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>- Throws:
Exception
-
length
public long length()- Specified by:
lengthin interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
-
progress
public long progress()- Specified by:
progressin interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
-