public abstract class CompressExtension extends AbstractExtension
Modifier and Type | Class and Description |
---|---|
private class |
CompressExtension.Flusher |
private static class |
CompressExtension.FrameEntry |
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
Modifier and Type | Field and Description |
---|---|
private static int |
DECOMPRESS_BUF_SIZE
Inflater : Output Buffer Size
|
protected java.util.concurrent.atomic.AtomicInteger |
decompressCount |
private java.util.zip.Deflater |
deflaterImpl |
private java.util.Queue<CompressExtension.FrameEntry> |
entries |
private IteratingCallback |
flusher |
protected static int |
INFLATE_BUFFER_SIZE
Inflater / Decompressed Buffer Size
|
private java.util.zip.Inflater |
inflaterImpl |
protected static int |
INPUT_MAX_BUFFER_SIZE
Deflater / Inflater: Maximum Input Buffer Size
|
private static Logger |
LOG |
private static boolean |
NOWRAP |
protected static int |
RSV_USE_ALWAYS
Always set RSV flag, on all frame types
|
protected static int |
RSV_USE_ONLY_FIRST
Only set RSV flag on first frame in multi-frame messages.
|
private int |
rsvUse |
protected static byte[] |
TAIL_BYTES |
protected static java.nio.ByteBuffer |
TAIL_BYTES_BUF |
protected static int |
TAIL_DROP_ALWAYS
Always drop tail bytes 0000FFFF, from all frame types
|
protected static int |
TAIL_DROP_FIN_ONLY
Only drop tail bytes 0000FFFF, from fin==true frames
|
protected static int |
TAIL_DROP_NEVER
Never drop tail bytes 0000FFFF, from any frame type
|
private int |
tailDrop |
Modifier | Constructor and Description |
---|---|
protected |
CompressExtension() |
Modifier and Type | Method and Description |
---|---|
protected void |
decompress(ByteAccumulator accumulator,
java.nio.ByteBuffer buf) |
protected void |
doStop() |
static boolean |
endsWithTail(java.nio.ByteBuffer buf) |
protected void |
forwardIncoming(Frame frame,
ByteAccumulator accumulator) |
java.util.zip.Deflater |
getDeflater() |
java.util.zip.Inflater |
getInflater() |
(package private) abstract int |
getRsvUseMode()
Return the mode of operation for RSV flag use in frames generate by compress (outgoing)
|
(package private) abstract int |
getTailDropMode()
Return the mode of operation for dropping (or keeping) tail bytes in frames generated by compress (outgoing)
|
boolean |
isRsv1User()
Indicates use of RSV1 flag for indicating deflation is in use.
|
protected ByteAccumulator |
newByteAccumulator() |
protected void |
notifyCallbackFailure(WriteCallback callback,
java.lang.Throwable failure) |
protected void |
notifyCallbackSuccess(WriteCallback callback) |
private void |
offerEntry(CompressExtension.FrameEntry entry) |
void |
outgoingFrame(Frame frame,
WriteCallback callback,
BatchMode batchMode)
A frame, and optional callback, intended for the network layer.
|
private CompressExtension.FrameEntry |
pollEntry() |
private static boolean |
supplyInput(java.util.zip.Deflater deflater,
java.nio.ByteBuffer buf) |
private static boolean |
supplyInput(java.util.zip.Inflater inflater,
java.nio.ByteBuffer buf) |
private static java.lang.String |
toDetail(java.util.zip.Deflater deflater) |
private static java.lang.String |
toDetail(java.util.zip.Inflater inflater) |
java.lang.String |
toString() |
getBufferPool, getConfig, getConnection, getName, getNextIncoming, getNextOutgoing, getPolicy, init, init, isRsv2User, isRsv3User, nextIncomingFrame, nextOutgoingFrame, setBufferPool, setConfig, setConnection, setNextIncomingFrames, setNextOutgoingFrames, setPolicy
addLifeCycleListener, doStart, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, setStopTimeout, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
incomingFrame
protected static final byte[] TAIL_BYTES
protected static final java.nio.ByteBuffer TAIL_BYTES_BUF
private static final Logger LOG
protected static final int TAIL_DROP_NEVER
protected static final int TAIL_DROP_ALWAYS
protected static final int TAIL_DROP_FIN_ONLY
protected static final int RSV_USE_ALWAYS
protected static final int RSV_USE_ONLY_FIRST
Note: this automatically means no-continuation frames have the RSV bit set
protected static final int INFLATE_BUFFER_SIZE
protected static final int INPUT_MAX_BUFFER_SIZE
private static final int DECOMPRESS_BUF_SIZE
private static final boolean NOWRAP
private final java.util.Queue<CompressExtension.FrameEntry> entries
private final IteratingCallback flusher
private java.util.zip.Deflater deflaterImpl
private java.util.zip.Inflater inflaterImpl
protected java.util.concurrent.atomic.AtomicInteger decompressCount
private int tailDrop
private int rsvUse
public java.util.zip.Deflater getDeflater()
public java.util.zip.Inflater getInflater()
public boolean isRsv1User()
isRsv1User
in interface Extension
isRsv1User
in class AbstractExtension
abstract int getTailDropMode()
TAIL_DROP_ALWAYS
, TAIL_DROP_FIN_ONLY
, or TAIL_DROP_NEVER
abstract int getRsvUseMode()
RSV_USE_ALWAYS
or RSV_USE_ONLY_FIRST
protected void forwardIncoming(Frame frame, ByteAccumulator accumulator)
protected ByteAccumulator newByteAccumulator()
protected void decompress(ByteAccumulator accumulator, java.nio.ByteBuffer buf) throws java.util.zip.DataFormatException
java.util.zip.DataFormatException
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
OutgoingFrames
Note: the frame can undergo many transformations in the various layers and extensions present in the implementation.
If you are implementing a mutation, you are obliged to handle the incoming WriteCallback appropriately.
frame
- the frame to eventually write to the network layer.callback
- the callback to notify when the frame is written.batchMode
- the batch mode requested by the sender.private void offerEntry(CompressExtension.FrameEntry entry)
private CompressExtension.FrameEntry pollEntry()
protected void notifyCallbackSuccess(WriteCallback callback)
protected void notifyCallbackFailure(WriteCallback callback, java.lang.Throwable failure)
private static boolean supplyInput(java.util.zip.Inflater inflater, java.nio.ByteBuffer buf)
private static boolean supplyInput(java.util.zip.Deflater deflater, java.nio.ByteBuffer buf)
private static java.lang.String toDetail(java.util.zip.Inflater inflater)
private static java.lang.String toDetail(java.util.zip.Deflater deflater)
public static boolean endsWithTail(java.nio.ByteBuffer buf)
protected void doStop() throws java.lang.Exception
doStop
in class AbstractLifeCycle
java.lang.Exception
public java.lang.String toString()
toString
in class AbstractExtension