public abstract class CompressionFormatFactory
extends java.lang.Object
CompressionFormats.
Additional compression formats can be 'plugged in' at runtime by putting a resource named FORMATS_RESOURCE
on the
classpath.
| Modifier and Type | Method and Description |
|---|---|
static java.util.Collection<CompressionFormat> |
allFormats() |
static org.apache.commons.compress.compressors.CompressorInputStream |
compressorInputStream(java.io.InputStream inputStream)
Determines the compression format from the first few bytes of the
inputStream and then wraps it in the
appropriate CompressorInputStream. |
static CompressionFormat |
forCompressorOutputStream(org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream)
Deprecated.
Should be replaced by a new method
CompressorOutputStream.getFormat() |
static CompressionFormat |
forContents(java.io.File file)
Reads the first few bytes from the given file and determines the compression format.
|
static CompressionFormat |
forContents(java.io.InputStream is)
Reads the first few bytes from the given input stream and determines the compression format.
|
static CompressionFormat |
forFileName(java.lang.String fileName) |
static CompressionFormat |
forFormatName(java.lang.String compressionFormatName) |
static long |
getUncompressedSize(org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream)
Deprecated.
Should be replaced by a new method
CompressorInputStream.getUncompressedSize() |
static org.apache.commons.compress.compressors.CompressorInputStream |
open(java.io.File compressedFile)
Determines the compression format from the first few bytes of the
compressedFile and then returns a
CompressorInputStream reading from the compressedFile. |
public static java.util.Collection<CompressionFormat> allFormats()
@Nullable public static CompressionFormat forFileName(java.lang.String fileName)
CompressionFormat for the given file name, or null iff a compression format cannot
be deduced from the fileNameFileNameUtil.isCompressedFilename(String)public static CompressionFormat forFormatName(java.lang.String compressionFormatName) throws org.apache.commons.compress.compressors.CompressorException
CompressionFormat for the given compressionFormatNameorg.apache.commons.compress.compressors.CompressorException - The compressionFormatName is unknown@Nullable public static CompressionFormat forContents(java.io.InputStream is) throws java.io.IOException
allFormats(), or null iff the stream contents has none of the known
compression formatsjava.io.IOException@Nullable public static CompressionFormat forContents(java.io.File file) throws java.io.IOException
allFormats(), or null iff the file contents has none of the known
compression formatsjava.io.IOException@Deprecated public static CompressionFormat forCompressorOutputStream(org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream)
CompressorOutputStream.getFormat()compressorOutputStream@Deprecated public static long getUncompressedSize(org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream)
CompressorInputStream.getUncompressedSize()public static org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream(java.io.InputStream inputStream)
throws java.io.IOException,
org.apache.commons.compress.compressors.CompressorException
inputStream and then wraps it in the
appropriate CompressorInputStream.java.io.IOExceptionorg.apache.commons.compress.compressors.CompressorExceptionpublic static org.apache.commons.compress.compressors.CompressorInputStream open(java.io.File compressedFile)
throws java.io.IOException,
org.apache.commons.compress.compressors.CompressorException
compressedFile and then returns a
CompressorInputStream reading from the compressedFile.
Is typically faster than CompressionFormatFactory.forContents(compressedFile).compressorInputStream(compressedFile).
java.io.IOExceptionorg.apache.commons.compress.compressors.CompressorException