org.apache.commons.compress.compressors.bzip2
Class BZip2Compressor

java.lang.Object
  extended by org.apache.commons.compress.PackableObject
      extended by org.apache.commons.compress.AbstractCompressor
          extended by org.apache.commons.compress.compressors.bzip2.BZip2Compressor
All Implemented Interfaces:
Compressor

public class BZip2Compressor
extends AbstractCompressor

Implementation of the Compressor Interface for BZip2.

Author:
christian.grobmeier

Field Summary
 
Fields inherited from class org.apache.commons.compress.PackableObject
CHOOSE_EXTENSION, CHOOSE_NAME
 
Constructor Summary
BZip2Compressor()
          Constructor.
 
Method Summary
 void compressTo(InputStream in, OutputStream out)
          Compresses the input stream and writes the compressed bytes to the output stream.
 void decompressTo(InputStream in, OutputStream out)
          Decompresses this file and writes the decompressed file to the output-stream
 String getDefaultFileExtension()
          Returns a String with the default file extension for this compressor.
 byte[] getHeader()
          Header byte array for this archive.
 String getName()
          Returns the ArchiveName for this archive.
 
Methods inherited from class org.apache.commons.compress.AbstractCompressor
compress, compress, compressTo, compressToHere, decompress, decompress, decompressTo
 
Methods inherited from class org.apache.commons.compress.PackableObject
identifyByHeader, isPackableWith
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BZip2Compressor

public BZip2Compressor()
Constructor.

Method Detail

compressTo

public void compressTo(InputStream in,
                       OutputStream out)
                throws CompressException
Description copied from interface: Compressor
Compresses the input stream and writes the compressed bytes to the output stream. This method must be implemented by all new compressortypes.

Parameters:
in - InputStream to compress to
out - OutputStream to which the byte shall be written
Throws:
CompressException - if the Compressor reports an error

decompressTo

public void decompressTo(InputStream in,
                         OutputStream out)
                  throws CompressException
Description copied from interface: Compressor
Decompresses this file and writes the decompressed file to the output-stream

Parameters:
in - Stream to decompress
out - Stream to write the decompressed bytes to
Throws:
CompressException - if the Compressor reports an error

getHeader

public byte[] getHeader()
Description copied from class: PackableObject
Header byte array for this archive.

Specified by:
getHeader in class PackableObject

getName

public String getName()
Description copied from class: PackableObject
Returns the ArchiveName for this archive.

Specified by:
getName in class PackableObject

getDefaultFileExtension

public String getDefaultFileExtension()
Description copied from class: AbstractCompressor
Returns a String with the default file extension for this compressor. For example, a zip-files default file extension would be "zip" (without leading dot).

Specified by:
getDefaultFileExtension in class AbstractCompressor
Returns:
the default file extension


Copyright © 2011 Apache Software Foundation. All Rights Reserved.