de.unkrig.commons.file.org.apache.commons.compress.compressors
Interface CompressionFormat

All Known Implementing Classes:
BZip2CompressionFormat, FramedSnappyCompressionFormat, GzipCompressionFormat, LZMACompressionFormat, Pack200CompressionFormat, SnappyCompressionFormat, XZCompressionFormat, ZCompressionFormat

public interface CompressionFormat

Representation of one compression format, e.g. GZ or Z. Compression formats are managed by CompressionFormatFactory.


Method Summary
 org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream(java.io.InputStream is)
           
 org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream(java.io.OutputStream os)
           
 org.apache.commons.compress.compressors.CompressorOutputStream create(java.io.File compressedFile)
          Creates a new compressed file.
 java.lang.String getCompressedFileName(java.lang.String fileName)
          Maps the given fileName to the name that a corresponding compressed file would have.
 java.lang.String getName()
           
 java.lang.String getUncompressedFileName(java.lang.String fileName)
          Maps the given fileName to the name that a corresponding uncompressed file would have.
 boolean isCompressedFileName(java.lang.String fileName)
           
 boolean matches(byte[] signature, int signatureLength)
           
 org.apache.commons.compress.compressors.CompressorInputStream open(java.io.File compressedFile)
          Opens an existing compressed file for reading.
 

Method Detail

getName

java.lang.String getName()
Returns:
A short, familiar text which describes this compression format, e.g. 'bzip2', 'gz', 'z'

isCompressedFileName

boolean isCompressedFileName(java.lang.String fileName)
Returns:
Whether the given fileName is typical for this CompressionFormat

getCompressedFileName

java.lang.String getCompressedFileName(java.lang.String fileName)
Maps the given fileName to the name that a corresponding compressed file would have. This is typically achieved by appending a suffix, like '.bzip2', '.gz', '.Z'.


getUncompressedFileName

java.lang.String getUncompressedFileName(java.lang.String fileName)
Maps the given fileName to the name that a corresponding uncompressed file would have. This is typically achieved by removing a suffix, like '.bzip2', '.gz', '.Z', or by changing the suffix, e.g. from '.tgz' to '.tar'.


compressorInputStream

org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream(java.io.InputStream is)
                                                                                    throws java.io.IOException
Returns:
A CompressorInputStream for this format which reads from the given input stream
Throws:
java.io.IOException

open

org.apache.commons.compress.compressors.CompressorInputStream open(java.io.File compressedFile)
                                                                   throws java.io.IOException
Opens an existing compressed file for reading.

Returns:
An CompressorInputStream for this format which reads from the given compressedFile
Throws:
java.io.IOException

compressorOutputStream

org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream(java.io.OutputStream os)
                                                                                      throws java.io.IOException,
                                                                                             org.apache.commons.compress.compressors.CompressorException
Returns:
An CompressorOutputStream for this format which writes to the given output stream
Throws:
org.apache.commons.compress.compressors.CompressorException - Creation of compressed contents in in this format is not supported
java.io.IOException

create

org.apache.commons.compress.compressors.CompressorOutputStream create(java.io.File compressedFile)
                                                                      throws java.io.IOException,
                                                                             org.apache.commons.compress.compressors.CompressorException
Creates a new compressed file.

Returns:
An CompressorOutputStream for this format which writes to the given compressedFile
Throws:
org.apache.commons.compress.compressors.CompressorException - Creation of compressed files in in this format is not supported
java.io.IOException

matches

boolean matches(byte[] signature,
                int signatureLength)
Returns:
Whether the first few bytes of compressed data match what is expected for this format