uk.org.ogsadai.activity.transform
Class GZIPIncrementalProcessor

java.lang.Object
  |
  +--uk.org.ogsadai.activity.transform.GZIPIncrementalProcessor
All Implemented Interfaces:
IncrementalProcessor

public class GZIPIncrementalProcessor
extends java.lang.Object
implements IncrementalProcessor

An IncrementalProcessor that reads from an InputStream, compresses the data using GZIP compression, and writes to an OutputStream.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private static int DEFAULT_BUFFER_SIZE
          Default buffer size
private  boolean mActive
          Indicates whether or not there is more processing to be done.
private  byte[] mBuffer
          Used as a buffer between the input and output stream.
private  java.util.zip.Checksum mChecksum
          References the checksum or null if no checksum is being used.
private  java.io.InputStream mInput
          Data is read from this stream and written to the output stream
private  java.util.zip.GZIPOutputStream mOutput
          Data read from the input is written to this stream
 
Constructor Summary
GZIPIncrementalProcessor(java.io.InputStream input, java.util.zip.Checksum checksum)
          Constructs an instance with the specified settings and default internal buffer size.
GZIPIncrementalProcessor(java.io.InputStream input, java.util.zip.Checksum checksum, int bufferSize)
          Constructs an instance with the specified settings.
 
Method Summary
 boolean active()
          Indicates whether or not processing is complete.
 void close()
          Closes the IncrementalProcessor, freeing up any resources.
 void initialise(java.io.OutputStream output)
          Initialises the instance to process to the specified output.
 void process()
          Performs some processing that may write data to the OutputStream that the instance was initialised with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mInput

private java.io.InputStream mInput
Data is read from this stream and written to the output stream


mOutput

private java.util.zip.GZIPOutputStream mOutput
Data read from the input is written to this stream


mChecksum

private java.util.zip.Checksum mChecksum
References the checksum or null if no checksum is being used.


mActive

private boolean mActive
Indicates whether or not there is more processing to be done.


mBuffer

private byte[] mBuffer
Used as a buffer between the input and output stream.


DEFAULT_BUFFER_SIZE

private static final int DEFAULT_BUFFER_SIZE
Default buffer size

See Also:
Constant Field Values
Constructor Detail

GZIPIncrementalProcessor

public GZIPIncrementalProcessor(java.io.InputStream input,
                                java.util.zip.Checksum checksum)
Constructs an instance with the specified settings and default internal buffer size.

Parameters:
input - The InputStream to read data from.
checksum - The Checksum object to use for the compression or null if no checksum is to be calculated.

GZIPIncrementalProcessor

public GZIPIncrementalProcessor(java.io.InputStream input,
                                java.util.zip.Checksum checksum,
                                int bufferSize)
Constructs an instance with the specified settings.

Parameters:
input - The InputStream to read data from.
checksum - The Checksum object to use for the compression or null if no checksum is to be calculated.
bufferSize - The size of the internal buffer used for each increment.
Method Detail

initialise

public void initialise(java.io.OutputStream output)
                throws java.io.IOException
Description copied from interface: IncrementalProcessor
Initialises the instance to process to the specified output.

Specified by:
initialise in interface IncrementalProcessor
Parameters:
output - The OutputStream
Throws:
java.io.IOException - If there is an I/O problem.

active

public boolean active()
Description copied from interface: IncrementalProcessor
Indicates whether or not processing is complete. If processing is not complete, then more processing can be performed by invoking the process method.

Specified by:
active in interface IncrementalProcessor
Returns:
true if processing is not complete, otherwise false.

process

public void process()
             throws java.io.IOException
Description copied from interface: IncrementalProcessor
Performs some processing that may write data to the OutputStream that the instance was initialised with.

Specified by:
process in interface IncrementalProcessor
Throws:
java.io.IOException - If there is an I/O problem.

close

public void close()
           throws java.io.IOException
Description copied from interface: IncrementalProcessor
Closes the IncrementalProcessor, freeing up any resources.

Specified by:
close in interface IncrementalProcessor
Throws:
java.io.IOException - If there is an I/O problem.