Class MessageChunksBuffer

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.MessageToMessageDecoder<MessageChunk>
org.drasyl.handler.stream.MessageChunksBuffer
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public class MessageChunksBuffer extends io.netty.handler.codec.MessageToMessageDecoder<MessageChunk>
Buffers until all MessageChunks belonging to the same message have been collected, then passes them in the correct order.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
    MessageChunksBuffer(int maxContentLength, int allChunksTimeout)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    decode(io.netty.channel.ChannelHandlerContext ctx, MessageChunk msg, List<Object> out)
     

    Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder

    acceptInboundMessage, channelRead

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

    • MessageChunksBuffer

      public MessageChunksBuffer(int maxContentLength, int allChunksTimeout)
      Creates a new instance.
      Parameters:
      maxContentLength - the maximum cumulative length of the aggregated message. If the length of the buffered content exceeds this value, a {@link TooLongFrameException)} will be thrown.
      allChunksTimeout - time in milliseconds after receiving the first chunk to wait for remaining chunks. Upon timeout, received chunks will be discarded. A value of 0 deactivates the timeout function.
  • Method Details