Package org.rauschig.jarchivelib
Class ArchiverFactory
- java.lang.Object
-
- org.rauschig.jarchivelib.ArchiverFactory
-
public final class ArchiverFactory extends java.lang.ObjectFactory for creatingArchiverinstances by a given archiver type name. Use the constants in this class to pass to the factory method.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ArchivercreateArchiver(java.io.File archive)Probes the givenFilefor its file type and creates anArchiverbased on this file type.static ArchivercreateArchiver(java.lang.String archiveFormat)Creates an Archiver for the given archive format.static ArchivercreateArchiver(java.lang.String archiveFormat, java.lang.String compression)Creates an Archiver for the given archive format that uses compression.static ArchivercreateArchiver(ArchiveFormat archiveFormat)Creates an Archiver for the given archive format.static ArchivercreateArchiver(ArchiveFormat archiveFormat, CompressionType compression)Creates an Archiver for the given archive format that uses compression.static ArchivercreateArchiver(FileType fileType)Creates an Archiver that handles the givenFileType.
-
-
-
Method Detail
-
createArchiver
public static Archiver createArchiver(java.io.File archive) throws java.lang.IllegalArgumentException
Probes the givenFilefor its file type and creates anArchiverbased on this file type. If the File has a composite file extension such as ".tar.gz", the createdArchiverwill also handle ".gz" compression.- Parameters:
archive- the archive file to check.- Returns:
- a new Archiver instance (that may also handle compression)
- Throws:
java.lang.IllegalArgumentException- if the given file is not a known archive
-
createArchiver
public static Archiver createArchiver(FileType fileType)
Creates an Archiver that handles the givenFileType. The Archiver may handle compression inherently, if theFileTypeuses a compression type, such as ".tgz" might.- Parameters:
fileType- the file type- Returns:
- a new Archiver instance (that may also handle compression)
-
createArchiver
public static Archiver createArchiver(java.lang.String archiveFormat, java.lang.String compression) throws java.lang.IllegalArgumentException
Creates an Archiver for the given archive format that uses compression.- Parameters:
archiveFormat- the archive format e.g. "tar" or "zip"compression- the compression algorithm name e.g. "gz"- Returns:
- a new Archiver instance that also handles compression
- Throws:
java.lang.IllegalArgumentException- if the archive format or the compression type is unknown
-
createArchiver
public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression)
Creates an Archiver for the given archive format that uses compression.- Parameters:
archiveFormat- the archive formatcompression- the compression algorithm- Returns:
- a new Archiver instance that also handles compression
-
createArchiver
public static Archiver createArchiver(java.lang.String archiveFormat) throws java.lang.IllegalArgumentException
Creates an Archiver for the given archive format.- Parameters:
archiveFormat- the archive format e.g. "tar" or "zip"- Returns:
- a new Archiver instance
- Throws:
java.lang.IllegalArgumentException- if the archive format is unknown
-
createArchiver
public static Archiver createArchiver(ArchiveFormat archiveFormat)
Creates an Archiver for the given archive format.- Parameters:
archiveFormat- the archive format- Returns:
- a new Archiver instance
-
-