public enum CompressionMode extends Enum<CompressionMode>
| Enum Constant and Description |
|---|
AUTO
Automatically infer compression from file extension.
|
GZIP
GZip compression.
|
NONE
No compression.
|
XZ
XZ compression.
|
| Modifier and Type | Method and Description |
|---|---|
static CompressionMode |
autodetect(File file)
Auto-detect a compression mode from a file's name.
|
static CompressionMode |
autodetect(String name)
Auto-detect a compression mode from a file name.
|
String |
getCompressorName() |
CompressionMode |
getEffectiveCompressionMode(String filename)
Get the effective compression mode.
|
static CompressionMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static CompressionMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
InputStream |
wrapInput(InputStream in)
Wrap an input stream in a decompressor.
|
OutputStream |
wrapOutput(OutputStream out)
Wrap an output stream in this compression mode.
|
public static final CompressionMode NONE
public static final CompressionMode GZIP
GZIPInputStream,
GZIPOutputStreampublic static final CompressionMode XZ
public static final CompressionMode AUTO
public static CompressionMode[] values()
for (CompressionMode c : CompressionMode.values()) System.out.println(c);
public static CompressionMode valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic String getCompressorName()
public CompressionMode getEffectiveCompressionMode(String filename)
AUTO, this auto-detects the appropriate
mode from the file name.filename - The filename to compress.AUTO.public OutputStream wrapOutput(OutputStream out) throws IOException
out - The stream to wrapout.IOException - If there is an error setting up the compressor.UnsupportedOperationException - if the mode is AUTO (use getEffectiveCompressionMode(String) first).public InputStream wrapInput(InputStream in) throws IOException
in - The input stream.in and decompresses as appropriate.IOException - If there is an error setting up the decompressor.UnsupportedOperationException - if the mode is AUTO (use getEffectiveCompressionMode(String) first).public static CompressionMode autodetect(String name)
name - The file name.AUTO.public static CompressionMode autodetect(File file)
file - The file.AUTO.