/** * @see {@link CompressorStreamFactory#createCompressorInputStream(String, java.io.InputStream)} */ static CompressorInputStream createCompressorInputStream(CompressionType compressionType, InputStream in) throws CompressorException { return compressorStreamFactory.createCompressorInputStream(compressionType.getName(), in); }
/** * Checks if the given compression type name is valid and known format. * * @param compression the compression algorithm name * @return true true if the given compression type is known to the factory, false otherwise */ public static boolean isValidCompressionType(String compression) { for (CompressionType type : values()) { if (compression.equalsIgnoreCase(type.getName())) { return true; } } return false; }
/** * Checks if the given compression type name is valid and known format. * * @param compression the compression algorithm name * @return true true if the given compression type is known to the factory, false otherwise */ public static boolean isValidCompressionType(String compression) { for (CompressionType type : values()) { if (compression.equalsIgnoreCase(type.getName())) { return true; } } return false; }
/** * @see {@link CompressorStreamFactory#createCompressorInputStream(String, java.io.InputStream)} */ static CompressorInputStream createCompressorInputStream(CompressionType compressionType, InputStream in) throws CompressorException { return compressorStreamFactory.createCompressorInputStream(compressionType.getName(), in); }
static CompressorOutputStream createCompressorOutputStream(CompressionType compressionType, File destination) throws IOException, CompressorException { return createCompressorOutputStream(compressionType.getName(), new FileOutputStream(destination)); }
static CompressorOutputStream createCompressorOutputStream(CompressionType compressionType, File destination) throws IOException, CompressorException { return createCompressorOutputStream(compressionType.getName(), new FileOutputStream(destination)); }
/** * Attempts to return the {@link CompressionType} instance from a possible given string representation. Ignores * case. * * @param compression string representation of the compression type. E.g. "GZIP". * @return the compression type enum * @throws IllegalArgumentException if the given compression type is unknown. */ public static CompressionType fromString(String compression) { for (CompressionType type : values()) { if (compression.equalsIgnoreCase(type.getName())) { return type; } } throw new IllegalArgumentException("Unknown compression type " + compression); } }
/** * Attempts to return the {@link CompressionType} instance from a possible given string representation. Ignores * case. * * @param compression string representation of the compression type. E.g. "GZIP". * @return the compression type enum * @throws IllegalArgumentException if the given compression type is unknown. */ public static CompressionType fromString(String compression) { for (CompressionType type : values()) { if (compression.equalsIgnoreCase(type.getName())) { return type; } } throw new IllegalArgumentException("Unknown compression type " + compression); } }