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.String
CLIENT_MAX_WINDOW_BITS
private static java.lang.String
CLIENT_NO_CONTEXT_TAKEOVER
private static byte[]
COMPRESSION_TERMINATOR
private static int
INCOMING_SLIDING_WINDOW_MARGIN
private static int
MAX_BITS
private static int
MAX_WINDOW_SIZE
private boolean
mClientNoContextTakeover
private int
mClientWindowSize
private static int
MIN_BITS
private static int
MIN_WINDOW_SIZE
private ByteArray
mIncomingSlidingWindow
private int
mIncomingSlidingWindowBufferSize
private boolean
mServerNoContextTakeover
private int
mServerWindowSize
private static java.lang.String
SERVER_MAX_WINDOW_BITS
private static java.lang.String
SERVER_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 void
appendEmptyBlock(ByteArray data, int[] bitIndex)
private boolean
canCompress(byte[] plain)
protected byte[]
compress(byte[] plain)
Compress the plain message.private int
computeWindowSize(java.lang.String key, java.lang.String value)
protected byte[]
decompress(byte[] compressed)
Decompress the compressed message.private int
extractMaxWindowBits(java.lang.String key, java.lang.String value)
int
getClientWindowSize()
int
getServerWindowSize()
boolean
isClientNoContextTakeover()
boolean
isServerNoContextTakeover()
private int
parseMaxWindowBits(java.lang.String value)
private static boolean
skipBlock(ByteArray input, int[] bitIndex, boolean[] hasEmptyBlock)
private static void
skipData(ByteArray input, int[] bitIndex, Huffman literalLengthHuffman, Huffman distanceHuffman)
private static void
skipDynamicBlock(ByteArray input, int[] bitIndex)
private static void
skipFixedBlock(ByteArray input, int[] bitIndex)
private static int
skipPlainBlock(ByteArray input, int[] bitIndex)
(package private) void
validate()
Validate this instance.private void
validateParameter(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 WebSocketException
Description copied from class:WebSocketExtension
Validate this instance. This method is expected to be overridden.- Overrides:
validate
in 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 WebSocketException
Description copied from class:PerMessageCompressionExtension
Decompress the compressed message.- Specified by:
decompress
in classPerMessageCompressionExtension
- Throws:
WebSocketException
-
compress
protected byte[] compress(byte[] plain) throws WebSocketException
Description copied from class:PerMessageCompressionExtension
Compress the plain message.- Specified by:
compress
in 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
-
-