public class PerMessageDeflateExtension extends Object implements IExtension
Modifier and Type | Class and Description |
---|---|
static class |
PerMessageDeflateExtension.NoContext
The context takeover control options
|
Modifier and Type | Field and Description |
---|---|
static String |
PERMESSAGE_DEFLATE_DECODER
The default key identifying the pre-message deflate decoder
PerMessageDeflateDecoder in the default codec pipeline created by the
SNF4J framework. |
static String |
PERMESSAGE_DEFLATE_ENCODER
The default key identifying the pre-message deflate encoder
PerMessageDeflateEncoder in the default codec pipeline created by the
SNF4J framework. |
Constructor and Description |
---|
PerMessageDeflateExtension()
Constructs a pre-message deflate extension with default compression level (6)
and the
OPTIONAL context takeover control option for
compression/decompression. |
PerMessageDeflateExtension(int compressionLevel)
Constructs a pre-message deflate extension with specified compression level
and the
OPTIONAL context takeover control option for
compression/decompression. |
PerMessageDeflateExtension(int compressionLevel,
int minInflateBound,
PerMessageDeflateExtension.NoContext compressNoContext,
PerMessageDeflateExtension.NoContext decompressNoContext)
Constructs a pre-message deflate extension with specified compression level,
minimum upper bound on the decompressed size and the context takeover control
options for compression/decompression.
|
PerMessageDeflateExtension(int compressionLevel,
PerMessageDeflateExtension.NoContext compressNoContext,
PerMessageDeflateExtension.NoContext decompressNoContext)
Constructs a pre-message deflate extension with specified compression level
and the context takeover control options for compression/decompression.
|
Modifier and Type | Method and Description |
---|---|
IExtension |
acceptOffer(List<String> offer)
Called by the Web Socket server to accept the received extension negotiation
offer.
|
Object |
getGroupId()
Returns an object that identifies the group to which the extension belongs.
|
String |
getName()
Returns the name of the extension.
|
List<String> |
offer()
Called by the Web Socket client to prepare the extension negotiation offer.
|
List<String> |
response()
Called by the Web Socket server to prepare the extension negotiation response.
|
void |
updateDecoders(ICodecPipeline pipeline)
Called to update the decoder pipeline.
|
void |
updateEncoders(ICodecPipeline pipeline)
Called to update the encoder pipeline.
|
protected void |
updatePipeline(ICodecPipeline pipeline,
IDecoder<Frame,Frame> decoder) |
protected void |
updatePipeline(ICodecPipeline pipeline,
IEncoder<Frame,Frame> encoder) |
IExtension |
validateResponse(List<String> response)
Called by the Web Socket client to validate the received extension negotiation
response.
|
public static final String PERMESSAGE_DEFLATE_DECODER
PerMessageDeflateDecoder
in the default codec pipeline created by the
SNF4J framework.public static final String PERMESSAGE_DEFLATE_ENCODER
PerMessageDeflateEncoder
in the default codec pipeline created by the
SNF4J framework.public PerMessageDeflateExtension(int compressionLevel, int minInflateBound, PerMessageDeflateExtension.NoContext compressNoContext, PerMessageDeflateExtension.NoContext decompressNoContext)
compressionLevel
- the compression level (0-9)minInflateBound
- determines the minimum upper bound on the
decompressed size. Setting this parameter to
proper value may speed up the decompression of
highly compressed data.compressNoContext
- the context takeover control for compressiondecompressNoContext
- the context takeover control for decompressionpublic PerMessageDeflateExtension(int compressionLevel, PerMessageDeflateExtension.NoContext compressNoContext, PerMessageDeflateExtension.NoContext decompressNoContext)
compressionLevel
- the compression level (0-9)compressNoContext
- the context takeover control for compressiondecompressNoContext
- the context takeover control for decompressionpublic PerMessageDeflateExtension(int compressionLevel)
OPTIONAL
context takeover control option for
compression/decompression.compressionLevel
- the compression level (0-9)public PerMessageDeflateExtension()
OPTIONAL
context takeover control option for
compression/decompression.public String getName()
getName
in interface IExtension
public Object getGroupId()
getGroupId
in interface IExtension
GroupIdentifier.COMPRESSION
public IExtension acceptOffer(List<String> offer) throws InvalidExtensionException
IExtension
extension-name, param-name1, param-value1, ... , param-nameN, param-valueNIf a parameter was offered with no value its value in the list will be
null
. For example following extension negotiation offer
foo; y=10; x; z="5"will be split into following list of tokens:
"foo", "y", "10", "x", null, "z", "5"
acceptOffer
in interface IExtension
offer
- the offer split into a list of tokensnull
if the negotiation offer could not be accepted by this
extension.InvalidExtensionException
- if the negotiation offer syntax was invalidpublic IExtension validateResponse(List<String> response) throws InvalidExtensionException
IExtension
extension-name, param-name1, param-value1, ... , param-nameN, param-valueNIf a parameter was responded with no value its value in the list will be
null
. For example following extension negotiation response
foo; y=10; x; z="5"will be split into following list of tokens:
"foo", "y", "10", "x", null, "z", "5"
validateResponse
in interface IExtension
response
- the response split into a list of tokensnull
if the negotiation response could not be validated by this
extension.InvalidExtensionException
- if the negotiation response syntax was invalidpublic List<String> offer()
IExtension
extension-name, param-name1, param-value1, ... , param-nameN, param-valueNIf a parameter in the offer has no value its value in the list have to be
null
. For example following extension negotiation offer
foo; y; x=10have to be split into following list of tokens:
"foo", "y", null, "y", "10"
offer
in interface IExtension
public List<String> response()
IExtension
extension-name, param-name1, param-value1, ... , param-nameN, param-valueNIf a parameter in the response has no value its value in the list have to be
null
. For example following extension negotiation response
foo; y; x=10have to be split into following list of tokens:
"foo", "y", null, "y", "10"
response
in interface IExtension
protected void updatePipeline(ICodecPipeline pipeline, IEncoder<Frame,Frame> encoder)
public void updateEncoders(ICodecPipeline pipeline)
IExtension
updateEncoders
in interface IExtension
pipeline
- the pipeline to updateprotected void updatePipeline(ICodecPipeline pipeline, IDecoder<Frame,Frame> decoder)
public void updateDecoders(ICodecPipeline pipeline)
IExtension
updateDecoders
in interface IExtension
pipeline
- the pipeline to updateCopyright © 2017–2022 SNF4J.ORG. All rights reserved.