org.glassfish.grizzly.compression.zip
Class GZipEncoder

java.lang.Object
  extended by org.glassfish.grizzly.AbstractTransformer<Buffer,Buffer>
      extended by org.glassfish.grizzly.compression.zip.GZipEncoder
All Implemented Interfaces:
Transformer<Buffer,Buffer>

public class GZipEncoder
extends AbstractTransformer<Buffer,Buffer>

This class implements a Transformer which encodes plain data to the GZIP format.

Author:
Alexey Stashok

Nested Class Summary
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
GZipEncoder()
           
GZipEncoder(int bufferSize)
           
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GZipEncoder

public GZipEncoder()

GZipEncoder

public GZipEncoder(int bufferSize)
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 class AbstractTransformer<Buffer,Buffer>

transformImpl

protected TransformationResult<Buffer,Buffer> transformImpl(AttributeStorage storage,
                                                            Buffer input)
                                                     throws TransformationException

Specified by:
transformImpl in class AbstractTransformer<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.



Copyright © 2012 Oracle Corporation. All Rights Reserved.