Class GZIPContentDecoder
- java.lang.Object
-
- org.eclipse.jetty.http.GZIPContentDecoder
-
- All Implemented Interfaces:
org.eclipse.jetty.util.component.Destroyable
public class GZIPContentDecoder extends Object implements org.eclipse.jetty.util.component.Destroyable
Decoder for the "gzip" encoding.A decoder that inflates gzip compressed data that has been optimized for async usage with minimal data copies.
-
-
Constructor Summary
Constructors Constructor Description GZIPContentDecoder()GZIPContentDecoder(int bufferSize)GZIPContentDecoder(org.eclipse.jetty.io.ByteBufferPool pool, int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufferacquire(int capacity)ByteBufferdecode(ByteBuffer compressed)Inflate compressed data from a buffer.protected voiddecodeChunks(ByteBuffer compressed)Inflate compressed data.protected booleandecodedChunk(ByteBuffer chunk)Called when a chunk of data is inflated.voiddestroy()booleanisFinished()voidrelease(ByteBuffer buffer)Release an allocated buffer.
-
-
-
Method Detail
-
decode
public ByteBuffer decode(ByteBuffer compressed)
Inflate compressed data from a buffer.- Parameters:
compressed- Buffer containing compressed data.- Returns:
- Buffer containing inflated data.
-
decodedChunk
protected boolean decodedChunk(ByteBuffer chunk)
Called when a chunk of data is inflated.The default implementation aggregates all the chunks into a single buffer returned from
decode(ByteBuffer). Derived implementations may choose to consume chunks individually and return false to prevent further inflation until a subsequent call todecode(ByteBuffer)ordecodeChunks(ByteBuffer).- Parameters:
chunk- The inflated chunk of data- Returns:
- False if inflating should continue, or True if the call
to
decodeChunks(ByteBuffer)ordecode(ByteBuffer)should return, allowing back pressure of compressed data.
-
decodeChunks
protected void decodeChunks(ByteBuffer compressed)
Inflate compressed data.Inflation continues until the compressed block end is reached, there is no more compressed data or a call to
decodedChunk(ByteBuffer)returns true.- Parameters:
compressed- Buffer of compressed data to inflate
-
destroy
public void destroy()
- Specified by:
destroyin interfaceorg.eclipse.jetty.util.component.Destroyable
-
isFinished
public boolean isFinished()
-
acquire
public ByteBuffer acquire(int capacity)
- Parameters:
capacity- capacity capacity of the allocated ByteBuffer- Returns:
- An indirect buffer of the configured buffersize either from the pool or freshly allocated.
-
release
public void release(ByteBuffer buffer)
Release an allocated buffer.This method will called
ByteBufferPool.release(ByteBuffer)if a buffer pool has been configured. This method should be called once for all buffers returned fromdecode(ByteBuffer)or passed todecodedChunk(ByteBuffer).- Parameters:
buffer- The buffer to release.
-
-