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 MessageChunk
s, allowing the receiver to reassemble the ByteBuf
in correct order. Useful
for protocols that does provide message ordering (like UDP
or drasyl).
ChannelPipeline
p = ...; ... 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:
isEndOfInput
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
- Throws:
Exception
-
close
- Specified by:
close
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
- Throws:
Exception
-
readChunk
- Specified by:
readChunk
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
- Throws:
Exception
-
readChunk
- Specified by:
readChunk
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
- Throws:
Exception
-
length
public long length()- Specified by:
length
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
-
progress
public long progress()- Specified by:
progress
in interfaceio.netty.handler.stream.ChunkedInput<MessageChunk>
-