public abstract class CompressionFormatFactory extends Object
CompressionFormat
s.
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 Collection<CompressionFormat> |
allFormats() |
static org.apache.commons.compress.compressors.CompressorInputStream |
compressorInputStream(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(File file)
Reads the first few bytes from the given file and determines the compression format.
|
static CompressionFormat |
forContents(InputStream is)
Reads the first few bytes from the given input stream and determines the compression format.
|
static CompressionFormat |
forFileName(String fileName) |
static CompressionFormat |
forFormatName(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(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 Collection<CompressionFormat> allFormats()
@Nullable public static CompressionFormat forFileName(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(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(InputStream is) throws IOException
allFormats()
, or null
iff the stream contents has none of the known
compression formatsIOException
@Nullable public static CompressionFormat forContents(File file) throws IOException
allFormats()
, or null
iff the file contents has none of the known
compression formatsIOException
@Deprecated public static CompressionFormat forCompressorOutputStream(org.apache.commons.compress.compressors.CompressorOutputStream compressorOutputStream)
CompressorOutputStream.getFormat()
@Deprecated public static long getUncompressedSize(org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream)
CompressorInputStream.getUncompressedSize()
public static org.apache.commons.compress.compressors.CompressorInputStream compressorInputStream(InputStream inputStream) throws IOException, org.apache.commons.compress.compressors.CompressorException
CompressorInputStream
.IOException
org.apache.commons.compress.compressors.CompressorException
public static org.apache.commons.compress.compressors.CompressorInputStream open(File compressedFile) throws IOException, org.apache.commons.compress.compressors.CompressorException
CompressorInputStream
reading from the compressedFile.
Is typically faster than CompressionFormatFactory.forContents(compressedFile).compressorInputStream(compressedFile)
.
IOException
org.apache.commons.compress.compressors.CompressorException
Copyright © 2018 Arno Unkrig. All rights reserved.