org.openstreetmap.osmosis.core.xml.common
Class CompressionActivator

java.lang.Object
  extended by org.openstreetmap.osmosis.core.xml.common.CompressionActivator

public class CompressionActivator
extends java.lang.Object

A utility class for layering compression streams on top of underlying byte streams based upon a specified compression algorithm.

Author:
Brett Henderson

Constructor Summary
CompressionActivator(CompressionMethod compressionMethod)
          Creates a new instance.
 
Method Summary
 java.io.InputStream createCompressionInputStream(java.io.InputStream sourceStream)
          Wraps a compression stream around the source stream based upon the requested compression method.
 java.io.OutputStream createCompressionOutputStream(java.io.OutputStream destinationStream)
          Wraps a compression stream around the destination stream based upon the requested compression method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressionActivator

public CompressionActivator(CompressionMethod compressionMethod)
Creates a new instance.

Parameters:
compressionMethod - The compression method to employ.
Method Detail

createCompressionOutputStream

public java.io.OutputStream createCompressionOutputStream(java.io.OutputStream destinationStream)
Wraps a compression stream around the destination stream based upon the requested compression method. If this method returns successfully, the input destination stream does not require closing after use because it will be closed when the returned output stream is closed.

Parameters:
destinationStream - The destination stream for receiving compressed data.
Returns:
A stream for writing compressed data to the destination stream.

createCompressionInputStream

public java.io.InputStream createCompressionInputStream(java.io.InputStream sourceStream)
Wraps a compression stream around the source stream based upon the requested compression method. If this method returns successfully, the input source stream does not require closing after use because it will be closed when the returned input stream is closed.

Parameters:
sourceStream - The source stream for providing compressed data.
Returns:
A stream for writing compressed data to the destination stream.