de.unkrig.commons.file.org.apache.commons.compress.compressors.snappy
Class FramedSnappyCompressionFormat

java.lang.Object
  extended by de.unkrig.commons.file.org.apache.commons.compress.compressors.snappy.FramedSnappyCompressionFormat
All Implemented Interfaces:
CompressionFormat

public final class FramedSnappyCompressionFormat
extends java.lang.Object
implements CompressionFormat

Representation of the 'framed snappy' compression format.


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.
static CompressionFormat get()
          Required by CompressionFormatFactory.
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static CompressionFormat get()
Required by CompressionFormatFactory.


getName

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

isCompressedFileName

public boolean isCompressedFileName(java.lang.String fileName)
Specified by:
isCompressedFileName in interface CompressionFormat
Returns:
Whether the given fileName is typical for this CompressionFormat

getCompressedFileName

public java.lang.String getCompressedFileName(java.lang.String fileName)
Description copied from interface: CompressionFormat
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'.

Specified by:
getCompressedFileName in interface CompressionFormat

getUncompressedFileName

public java.lang.String getUncompressedFileName(java.lang.String fileName)
Description copied from interface: CompressionFormat
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'.

Specified by:
getUncompressedFileName in interface CompressionFormat

compressorInputStream

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

open

public org.apache.commons.compress.compressors.CompressorInputStream open(java.io.File compressedFile)
                                                                   throws java.io.IOException
Description copied from interface: CompressionFormat
Opens an existing compressed file for reading.

Specified by:
open in interface CompressionFormat
Returns:
An CompressorInputStream for this format which reads from the given compressedFile
Throws:
java.io.IOException

compressorOutputStream

public org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream(java.io.OutputStream os)
                                                                                      throws org.apache.commons.compress.compressors.CompressorException
Specified by:
compressorOutputStream in interface CompressionFormat
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

create

public org.apache.commons.compress.compressors.CompressorOutputStream create(java.io.File compressedFile)
                                                                      throws org.apache.commons.compress.compressors.CompressorException
Description copied from interface: CompressionFormat
Creates a new compressed file.

Specified by:
create in interface CompressionFormat
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

matches

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

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object