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
class PerMessageDeflateEncoder extends DeflateEncoder
Per-message implementation of deflate compressor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
compressing
-
Constructor Summary
Constructors Constructor Description PerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext)
ConstructorPerMessageDeflateEncoder(int compressionLevel, int windowSize, boolean noContext, WebSocketExtensionFilter extensionEncoderFilter)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptOutboundMessage(java.lang.Object msg)
Returnstrue
if the given message should be handled.protected void
encode(ChannelHandlerContext ctx, WebSocketFrame msg, java.util.List<java.lang.Object> out)
Encode from one message to an other.protected boolean
removeFrameTail(WebSocketFrame msg)
protected int
rsv(WebSocketFrame msg)
-
Methods inherited from class io.netty.handler.codec.http.websocketx.extensions.compression.DeflateEncoder
extensionEncoderFilter, handlerRemoved
-
Methods inherited from class io.netty.handler.codec.MessageToMessageEncoder
write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, 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
exceptionCaught, handlerAdded
-
-
-
-
Constructor Detail
-
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 Detail
-
acceptOutboundMessage
public boolean acceptOutboundMessage(java.lang.Object msg) throws java.lang.Exception
Description copied from class:MessageToMessageEncoder
Returnstrue
if the given message should be handled. Iffalse
it will be passed to the nextChannelOutboundHandler
in theChannelPipeline
.- Overrides:
acceptOutboundMessage
in classMessageToMessageEncoder<WebSocketFrame>
- Throws:
java.lang.Exception
-
rsv
protected int rsv(WebSocketFrame msg)
- Specified by:
rsv
in classDeflateEncoder
- Parameters:
msg
- the current frame.- Returns:
- the rsv bits to set in the compressed frame.
-
removeFrameTail
protected boolean removeFrameTail(WebSocketFrame msg)
- Specified by:
removeFrameTail
in classDeflateEncoder
- Parameters:
msg
- the current frame.- Returns:
- true if compressed payload tail needs to be removed.
-
encode
protected void encode(ChannelHandlerContext ctx, WebSocketFrame msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
Description copied from class:MessageToMessageEncoder
Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.- Overrides:
encode
in classDeflateEncoder
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToMessageEncoder
belongs tomsg
- the message to encode to an other oneout
- theList
into which the encoded msg should be added needs to do some kind of aggregation- Throws:
java.lang.Exception
- is thrown if an error occurs
-
-