public abstract class ArchiveFormatFactory extends Object
ArchiveFormat
s.
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 Collection<ArchiveFormat> |
allFormats() |
static org.apache.commons.compress.archivers.ArchiveInputStream |
archiveInputStream(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(File file)
Reads the first few bytes from the given file and determines the archive format.
|
static ArchiveFormat |
forContents(InputStream is)
Reads the first few bytes from the given input stream and determines the archive format.
|
static ArchiveFormat |
forFileName(String fileName) |
static ArchiveFormat |
forFormatName(String archiveFormatName) |
static long |
getEntryCrc32(org.apache.commons.compress.archivers.ArchiveEntry archiveEntry)
Deprecated.
Should be replaced by a new method
ArchiveEntry.getCrc32() |
static String |
normalizeEntryName(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(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 Collection<ArchiveFormat> allFormats()
@Nullable public static ArchiveFormat forFileName(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(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(InputStream is) throws IOException
allFormats()
, or null
iff the stream contents has none of the known
archive formatsIOException
@Nullable public static ArchiveFormat forContents(File file) throws IOException
allFormats()
, or null
iff the file contents has none of the known
archive formatsIOException
@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(InputStream inputStream) throws IOException, org.apache.commons.compress.archivers.ArchiveException
ArchiveInputStream
.IOException
org.apache.commons.compress.archivers.ArchiveException
public static org.apache.commons.compress.archivers.ArchiveInputStream open(File archiveFile) throws IOException, org.apache.commons.compress.archivers.ArchiveException
ArchiveInputStream
reading from the archiveFile.
Is typically faster than ArchiveFormatFactory.forContents(archiveFile).archiveInputStream(archiveFile)
.
IOException
org.apache.commons.compress.archivers.ArchiveException
public static String normalizeEntryName(String name)
ArchiveEntry.getName()
such that
Copyright © 2018 Arno Unkrig. All rights reserved.