Package com.neovisionaries.ws.client
Class PerMessageDeflateExtension
- java.lang.Object
-
- com.neovisionaries.ws.client.WebSocketExtension
-
- com.neovisionaries.ws.client.PerMessageCompressionExtension
-
- com.neovisionaries.ws.client.PerMessageDeflateExtension
-
class PerMessageDeflateExtension extends PerMessageCompressionExtension
Per-Message Deflate Extension (7. The "permessage-deflate" Extension in RFC 7692).
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCLIENT_MAX_WINDOW_BITSprivate static java.lang.StringCLIENT_NO_CONTEXT_TAKEOVERprivate static byte[]COMPRESSION_TERMINATORprivate static intINCOMING_SLIDING_WINDOW_MARGINprivate static intMAX_BITSprivate static intMAX_WINDOW_SIZEprivate booleanmClientNoContextTakeoverprivate intmClientWindowSizeprivate static intMIN_BITSprivate static intMIN_WINDOW_SIZEprivate ByteArraymIncomingSlidingWindowprivate intmIncomingSlidingWindowBufferSizeprivate booleanmServerNoContextTakeoverprivate intmServerWindowSizeprivate static java.lang.StringSERVER_MAX_WINDOW_BITSprivate static java.lang.StringSERVER_NO_CONTEXT_TAKEOVER-
Fields inherited from class com.neovisionaries.ws.client.WebSocketExtension
PERMESSAGE_DEFLATE
-
-
Constructor Summary
Constructors Constructor Description PerMessageDeflateExtension()PerMessageDeflateExtension(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static byte[]adjustCompressedData(byte[] compressed)private static voidappendEmptyBlock(ByteArray data, int[] bitIndex)private booleancanCompress(byte[] plain)protected byte[]compress(byte[] plain)Compress the plain message.private intcomputeWindowSize(java.lang.String key, java.lang.String value)protected byte[]decompress(byte[] compressed)Decompress the compressed message.private intextractMaxWindowBits(java.lang.String key, java.lang.String value)intgetClientWindowSize()intgetServerWindowSize()booleanisClientNoContextTakeover()booleanisServerNoContextTakeover()private intparseMaxWindowBits(java.lang.String value)private static booleanskipBlock(ByteArray input, int[] bitIndex, boolean[] hasEmptyBlock)private static voidskipData(ByteArray input, int[] bitIndex, Huffman literalLengthHuffman, Huffman distanceHuffman)private static voidskipDynamicBlock(ByteArray input, int[] bitIndex)private static voidskipFixedBlock(ByteArray input, int[] bitIndex)private static intskipPlainBlock(ByteArray input, int[] bitIndex)(package private) voidvalidate()Validate this instance.private voidvalidateParameter(java.lang.String key, java.lang.String value)-
Methods inherited from class com.neovisionaries.ws.client.WebSocketExtension
containsParameter, getName, getParameter, getParameters, parse, setParameter, toString
-
-
-
-
Field Detail
-
SERVER_NO_CONTEXT_TAKEOVER
private static final java.lang.String SERVER_NO_CONTEXT_TAKEOVER
- See Also:
- Constant Field Values
-
CLIENT_NO_CONTEXT_TAKEOVER
private static final java.lang.String CLIENT_NO_CONTEXT_TAKEOVER
- See Also:
- Constant Field Values
-
SERVER_MAX_WINDOW_BITS
private static final java.lang.String SERVER_MAX_WINDOW_BITS
- See Also:
- Constant Field Values
-
CLIENT_MAX_WINDOW_BITS
private static final java.lang.String CLIENT_MAX_WINDOW_BITS
- See Also:
- Constant Field Values
-
COMPRESSION_TERMINATOR
private static final byte[] COMPRESSION_TERMINATOR
-
MIN_BITS
private static final int MIN_BITS
- See Also:
- Constant Field Values
-
MAX_BITS
private static final int MAX_BITS
- See Also:
- Constant Field Values
-
MIN_WINDOW_SIZE
private static final int MIN_WINDOW_SIZE
- See Also:
- Constant Field Values
-
MAX_WINDOW_SIZE
private static final int MAX_WINDOW_SIZE
- See Also:
- Constant Field Values
-
INCOMING_SLIDING_WINDOW_MARGIN
private static final int INCOMING_SLIDING_WINDOW_MARGIN
- See Also:
- Constant Field Values
-
mServerNoContextTakeover
private boolean mServerNoContextTakeover
-
mClientNoContextTakeover
private boolean mClientNoContextTakeover
-
mServerWindowSize
private int mServerWindowSize
-
mClientWindowSize
private int mClientWindowSize
-
mIncomingSlidingWindowBufferSize
private int mIncomingSlidingWindowBufferSize
-
mIncomingSlidingWindow
private ByteArray mIncomingSlidingWindow
-
-
Method Detail
-
validate
void validate() throws WebSocketExceptionDescription copied from class:WebSocketExtensionValidate this instance. This method is expected to be overridden.- Overrides:
validatein classWebSocketExtension- Throws:
WebSocketException
-
isServerNoContextTakeover
public boolean isServerNoContextTakeover()
-
isClientNoContextTakeover
public boolean isClientNoContextTakeover()
-
getServerWindowSize
public int getServerWindowSize()
-
getClientWindowSize
public int getClientWindowSize()
-
validateParameter
private void validateParameter(java.lang.String key, java.lang.String value) throws WebSocketException- Throws:
WebSocketException
-
computeWindowSize
private int computeWindowSize(java.lang.String key, java.lang.String value) throws WebSocketException- Throws:
WebSocketException
-
extractMaxWindowBits
private int extractMaxWindowBits(java.lang.String key, java.lang.String value) throws WebSocketException- Throws:
WebSocketException
-
parseMaxWindowBits
private int parseMaxWindowBits(java.lang.String value)
-
decompress
protected byte[] decompress(byte[] compressed) throws WebSocketExceptionDescription copied from class:PerMessageCompressionExtensionDecompress the compressed message.- Specified by:
decompressin classPerMessageCompressionExtension- Throws:
WebSocketException
-
compress
protected byte[] compress(byte[] plain) throws WebSocketExceptionDescription copied from class:PerMessageCompressionExtensionCompress the plain message.- Specified by:
compressin classPerMessageCompressionExtension- Throws:
WebSocketException
-
canCompress
private boolean canCompress(byte[] plain)
-
adjustCompressedData
private static byte[] adjustCompressedData(byte[] compressed) throws FormatException- Throws:
FormatException
-
appendEmptyBlock
private static void appendEmptyBlock(ByteArray data, int[] bitIndex)
-
skipBlock
private static boolean skipBlock(ByteArray input, int[] bitIndex, boolean[] hasEmptyBlock) throws FormatException
- Throws:
FormatException
-
skipPlainBlock
private static int skipPlainBlock(ByteArray input, int[] bitIndex)
-
skipFixedBlock
private static void skipFixedBlock(ByteArray input, int[] bitIndex) throws FormatException
- Throws:
FormatException
-
skipDynamicBlock
private static void skipDynamicBlock(ByteArray input, int[] bitIndex) throws FormatException
- Throws:
FormatException
-
skipData
private static void skipData(ByteArray input, int[] bitIndex, Huffman literalLengthHuffman, Huffman distanceHuffman) throws FormatException
- Throws:
FormatException
-
-