/** * Creates a compressor from the given compression type. * * @param compression the name of the compression algorithm e.g. "gz" or "bzip2". * @return a new {@link Compressor} instance for the given compression algorithm * @throws IllegalArgumentException if the compression type is unknown */ public static Compressor createCompressor(String compression) throws IllegalArgumentException { if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unkonwn compression type " + compression); } return createCompressor(CompressionType.fromString(compression)); }
/** * Creates a compressor from the given compression type. * * @param compression the name of the compression algorithm e.g. "gz" or "bzip2". * @return a new {@link Compressor} instance for the given compression algorithm * @throws IllegalArgumentException if the compression type is unknown */ public static Compressor createCompressor(String compression) throws IllegalArgumentException { if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unkonwn compression type " + compression); } return createCompressor(CompressionType.fromString(compression)); }
/** * Creates an Archiver for the given archive format that uses compression. * * @param archiveFormat the archive format e.g. "tar" or "zip" * @param compression the compression algorithm name e.g. "gz" * @return a new Archiver instance that also handles compression * @throws IllegalArgumentException if the archive format or the compression type is unknown */ public static Archiver createArchiver(String archiveFormat, String compression) throws IllegalArgumentException { if (!ArchiveFormat.isValidArchiveFormat(archiveFormat)) { throw new IllegalArgumentException("Unknown archive format " + archiveFormat); } if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unknown compression type " + compression); } return createArchiver(ArchiveFormat.fromString(archiveFormat), CompressionType.fromString(compression)); }
/** * Creates an Archiver for the given archive format that uses compression. * * @param archiveFormat the archive format e.g. "tar" or "zip" * @param compression the compression algorithm name e.g. "gz" * @return a new Archiver instance that also handles compression * @throws IllegalArgumentException if the archive format or the compression type is unknown */ public static Archiver createArchiver(String archiveFormat, String compression) throws IllegalArgumentException { if (!ArchiveFormat.isValidArchiveFormat(archiveFormat)) { throw new IllegalArgumentException("Unknown archive format " + archiveFormat); } if (!CompressionType.isValidCompressionType(compression)) { throw new IllegalArgumentException("Unknown compression type " + compression); } return createArchiver(ArchiveFormat.fromString(archiveFormat), CompressionType.fromString(compression)); }