Class PerMessageDeflateEncoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
io.netty.handler.codec.MessageToMessageEncoder<WebSocketFrame>
io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionEncoder
io.netty.handler.codec.http.websocketx.extensions.compression.DeflateEncoder
io.netty.handler.codec.http.websocketx.extensions.compression.PerMessageDeflateEncoder
- All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler
Per-message implementation of deflate compressor.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext) ConstructorPerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext, WebSocketExtensionFilter extensionEncoderFilter) Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif the given message should be handled.protected voidencode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) Encode from one message to an other.protected booleanprotected intrsv(WebSocketFrame msg) Methods inherited from class DeflateEncoder
extensionEncoderFilter, handlerRemovedMethods inherited from class MessageToMessageEncoder
writeMethods inherited from class ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
exceptionCaught, handlerAdded
-
Field Details
-
compressing
private boolean compressing
-
-
Constructor Details
-
PerMessageDeflateEncoder
PerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext) Constructor- Parameters:
compressionLevel- compression level of the compressor.windowSize- maximum size of the window compressor buffer.noContext- true to disable context takeover.
-
PerMessageDeflateEncoder
PerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext, WebSocketExtensionFilter extensionEncoderFilter) Constructor- Parameters:
compressionLevel- compression level of the compressor.windowSize- maximum size of the window compressor buffer.noContext- true to disable context takeover.extensionEncoderFilter- extension filter for per message deflate encoder.
-
-
Method Details
-
acceptOutboundMessage
Description copied from class:MessageToMessageEncoderReturnstrueif the given message should be handled. Iffalseit will be passed to the nextChannelOutboundHandlerin theChannelPipeline.- Overrides:
acceptOutboundMessagein classMessageToMessageEncoder<WebSocketFrame>- Throws:
Exception
-
rsv
- Specified by:
rsvin classDeflateEncoder- Parameters:
msg- the current frame.- Returns:
- the rsv bits to set in the compressed frame.
-
removeFrameTail
- Specified by:
removeFrameTailin classDeflateEncoder- Parameters:
msg- the current frame.- Returns:
- true if compressed payload tail needs to be removed.
-
encode
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, List<Object> out) throws Exception Description copied from class:MessageToMessageEncoderEncode from one message to an other. This method will be called for each written message that can be handled by this encoder.- Overrides:
encodein classDeflateEncoder- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToMessageEncoderbelongs tomsg- the message to encode to an other oneout- theListinto which the encoded msg should be added needs to do some kind of aggregation- Throws:
Exception- is thrown if an error occurs
-