Class ChunkedMessageHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<I>
-
- org.drasyl.peer.connection.handler.SimpleChannelDuplexHandler<ChunkedMessage,ApplicationMessage>
-
- org.drasyl.peer.connection.handler.stream.ChunkedMessageHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
public class ChunkedMessageHandler extends SimpleChannelDuplexHandler<ChunkedMessage,ApplicationMessage>
This handler allows you to send messages that are too large for the underlying WebSocket transport layer. To do this, this handler splits the message into a series of non-overlapping chunks.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CHUNK_HANDLER
static int
CHUNK_SIZE
-
Constructor Summary
Constructors Constructor Description ChunkedMessageHandler(int maxContentLength, CompressedPublicKey myIdentity, Duration transferTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, ChunkedMessage msg)
Is called for each message of typeSimpleChannelDuplexHandler
on inbound channel.protected void
channelWrite0(io.netty.channel.ChannelHandlerContext ctx, ApplicationMessage msg, io.netty.channel.ChannelPromise promise)
Is called for each message of typeSimpleChannelDuplexHandler
on the outbound channel.-
Methods inherited from class org.drasyl.peer.connection.handler.SimpleChannelDuplexHandler
acceptOutboundMessage, bind, close, connect, deregister, disconnect, flush, read, write
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
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
-
-
-
-
Field Detail
-
CHUNK_HANDLER
public static final String CHUNK_HANDLER
- See Also:
- Constant Field Values
-
CHUNK_SIZE
public static final int CHUNK_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChunkedMessageHandler
public ChunkedMessageHandler(int maxContentLength, CompressedPublicKey myIdentity, Duration transferTimeout)
-
-
Method Detail
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, ChunkedMessage msg)
Description copied from class:SimpleChannelDuplexHandler
Is called for each message of typeSimpleChannelDuplexHandler
on inbound channel.- Specified by:
channelRead0
in classSimpleChannelDuplexHandler<ChunkedMessage,ApplicationMessage>
- Parameters:
ctx
- theChannelHandlerContext
which thisSimpleChannelDuplexHandler
belongs tomsg
- the message to handle
-
channelWrite0
protected void channelWrite0(io.netty.channel.ChannelHandlerContext ctx, ApplicationMessage msg, io.netty.channel.ChannelPromise promise)
Description copied from class:SimpleChannelDuplexHandler
Is called for each message of typeSimpleChannelDuplexHandler
on the outbound channel.- Specified by:
channelWrite0
in classSimpleChannelDuplexHandler<ChunkedMessage,ApplicationMessage>
- Parameters:
ctx
- theChannelHandlerContext
which thisSimpleChannelDuplexHandler
belongs tomsg
- the message to handlepromise
- the corresponding promise
-
-