Package org.rauschig.jarchivelib
Class CompressorFactory
- java.lang.Object
-
- org.rauschig.jarchivelib.CompressorFactory
-
public final class CompressorFactory extends java.lang.ObjectFactory for creatingCompressorinstances by a given compression algorithm. 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 CompressorcreateCompressor(java.io.File file)Probes the givenFilefor its file type and creates aCompressorbased on this file type.static CompressorcreateCompressor(java.lang.String compression)Creates a compressor from the given compression type.static CompressorcreateCompressor(CompressionType compression)Creates a compressor from the given CompressionType.static CompressorcreateCompressor(FileType fileType)Creates a newCompressorfor the givenFileType.
-
-
-
Method Detail
-
createCompressor
public static Compressor createCompressor(java.io.File file) throws java.lang.IllegalArgumentException
Probes the givenFilefor its file type and creates aCompressorbased on this file type.- Parameters:
file- the file to check.- Returns:
- a new Compressor instance
- Throws:
java.lang.IllegalArgumentException- if the given file is not a known compressed file type
-
createCompressor
public static Compressor createCompressor(FileType fileType) throws java.lang.IllegalArgumentException
Creates a newCompressorfor the givenFileType.- Parameters:
fileType- the file type to create the compressor for- Returns:
- a new Compressor instance
- Throws:
java.lang.IllegalArgumentException- if the given file type is not a known compression type
-
createCompressor
public static Compressor createCompressor(java.lang.String compression) throws java.lang.IllegalArgumentException
Creates a compressor from the given compression type.- Parameters:
compression- the name of the compression algorithm e.g. "gz" or "bzip2".- Returns:
- a new
Compressorinstance for the given compression algorithm - Throws:
java.lang.IllegalArgumentException- if the compression type is unknown
-
createCompressor
public static Compressor createCompressor(CompressionType compression)
Creates a compressor from the given CompressionType.- Parameters:
compression- the type of the compression algorithm- Returns:
- a new
Compressorinstance that uses the specified compression algorithm.
-
-