Class GZipEncoder
- java.lang.Object
-
- org.glassfish.grizzly.AbstractTransformer<Buffer,Buffer>
-
- org.glassfish.grizzly.compression.zip.GZipEncoder
-
- All Implemented Interfaces:
Transformer<Buffer,Buffer>
public class GZipEncoder extends AbstractTransformer<Buffer,Buffer>
This class implements aTransformer
which encodes plain data to the GZIP format.- Author:
- Alexey Stashok
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GZipEncoder.GZipOutputState
-
Nested classes/interfaces inherited from class org.glassfish.grizzly.AbstractTransformer
AbstractTransformer.LastResultAwareState<K,L>
-
-
Field Summary
-
Fields inherited from class org.glassfish.grizzly.AbstractTransformer
attributeBuilder, stateAttr
-
-
Constructor Summary
Constructors Constructor Description GZipEncoder()
GZipEncoder(int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GZipEncoder.GZipOutputState
createStateObject()
protected Buffer
deflate(Deflater deflater, MemoryManager memoryManager)
Writes next block of compressed data to the output stream.Buffer
finish(AttributeStorage storage)
Finishes to compress data to the output stream without closing the underlying stream.String
getName()
Get the Transformer name.boolean
hasInputRemaining(AttributeStorage storage, Buffer input)
protected TransformationResult<Buffer,Buffer>
transformImpl(AttributeStorage storage, Buffer input)
-
Methods inherited from class org.glassfish.grizzly.AbstractTransformer
getLastResult, getMemoryManager, getNamePrefix, getValue, obtainMemoryManager, obtainStateObject, release, saveLastResult, setMemoryManager, transform
-
-
-
-
Method Detail
-
getName
public String getName()
Get the Transformer name. The name is used to store Transformer associated data.- Returns:
- The Transformer name.
-
hasInputRemaining
public boolean hasInputRemaining(AttributeStorage storage, Buffer input)
-
createStateObject
protected GZipEncoder.GZipOutputState createStateObject()
- Overrides:
createStateObject
in classAbstractTransformer<Buffer,Buffer>
-
transformImpl
protected TransformationResult<Buffer,Buffer> transformImpl(AttributeStorage storage, Buffer input) throws TransformationException
- Specified by:
transformImpl
in classAbstractTransformer<Buffer,Buffer>
- Throws:
TransformationException
-
finish
public Buffer finish(AttributeStorage storage)
Finishes to compress data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.- Returns:
Buffer
with the last GZIP data to be sent.
-
deflate
protected Buffer deflate(Deflater deflater, MemoryManager memoryManager)
Writes next block of compressed data to the output stream.
-
-