public abstract class ArchiveFormatFactory
extends java.lang.Object
ArchiveFormats.
Additional archive 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<ArchiveFormat> |
allFormats() |
static org.apache.commons.compress.archivers.ArchiveInputStream |
archiveInputStream(java.io.InputStream inputStream)
Determines the archive format from the first few bytes of the
inputStream and then wraps it in the
appropriate ArchiveInputStream. |
static ArchiveFormat |
forArchiveOutputStream(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream)
Deprecated.
Should be replaced by a new method
ArchiveOutputStream.getFormat() |
static ArchiveFormat |
forContents(java.io.File file)
Reads the first few bytes from the given file and determines the archive format.
|
static ArchiveFormat |
forContents(java.io.InputStream is)
Reads the first few bytes from the given input stream and determines the archive format.
|
static ArchiveFormat |
forFileName(java.lang.String fileName) |
static ArchiveFormat |
forFormatName(java.lang.String archiveFormatName) |
static long |
getEntryCrc32(org.apache.commons.compress.archivers.ArchiveEntry archiveEntry)
Deprecated.
Should be replaced by a new method
ArchiveEntry.getCrc32() |
static java.lang.String |
normalizeEntryName(java.lang.String name)
Normalizes an entry name produced by
ArchiveEntry.getName() such that
The names of two entries in two archives are typically regarded as equal by users
The name never ands with a slash ('/')
This is necessary because e.g. for the ZIP-derived archive formats the names of DIRECTORY entries always have
a trailing slash, which is not the case for other archive formats. |
static org.apache.commons.compress.archivers.ArchiveInputStream |
open(java.io.File archiveFile)
Determines the archive format from the first few bytes of the
archiveFile and then returns a
ArchiveInputStream reading from the archiveFile. |
public static java.util.Collection<ArchiveFormat> allFormats()
@Nullable public static ArchiveFormat forFileName(java.lang.String fileName)
ArchiveFormat for the given file name, or null iff an archive format cannot
be deduced from the fileNameFileNameUtil.isCompressedFilename(String)public static ArchiveFormat forFormatName(java.lang.String archiveFormatName) throws org.apache.commons.compress.archivers.ArchiveException
ArchiveFormat for the given archiveFormatNameorg.apache.commons.compress.archivers.ArchiveException - The archiveFormatName is unknown@Nullable public static ArchiveFormat forContents(java.io.InputStream is) throws java.io.IOException
allFormats(), or null iff the stream contents has none of the known
archive formatsjava.io.IOException@Nullable public static ArchiveFormat forContents(java.io.File file) throws java.io.IOException
allFormats(), or null iff the file contents has none of the known
archive formatsjava.io.IOException@Deprecated public static ArchiveFormat forArchiveOutputStream(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream)
ArchiveOutputStream.getFormat()ArchiveFormat corresponding with the archiveOutputStream@Deprecated public static long getEntryCrc32(org.apache.commons.compress.archivers.ArchiveEntry archiveEntry)
ArchiveEntry.getCrc32()public static org.apache.commons.compress.archivers.ArchiveInputStream archiveInputStream(java.io.InputStream inputStream)
throws java.io.IOException,
org.apache.commons.compress.archivers.ArchiveException
inputStream and then wraps it in the
appropriate ArchiveInputStream.java.io.IOExceptionorg.apache.commons.compress.archivers.ArchiveExceptionpublic static org.apache.commons.compress.archivers.ArchiveInputStream open(java.io.File archiveFile)
throws java.io.IOException,
org.apache.commons.compress.archivers.ArchiveException
archiveFile and then returns a
ArchiveInputStream reading from the archiveFile.
Is typically faster than ArchiveFormatFactory.forContents(archiveFile).archiveInputStream(archiveFile).
java.io.IOExceptionorg.apache.commons.compress.archivers.ArchiveExceptionpublic static java.lang.String normalizeEntryName(java.lang.String name)
ArchiveEntry.getName() such that