public enum CompressionMode extends java.lang.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(java.io.File file)
Auto-detect a compression mode from a file’s name.
|
static CompressionMode |
autodetect(java.lang.String name)
Auto-detect a compression mode from a file name.
|
java.lang.String |
getCompressorName() |
CompressionMode |
getEffectiveCompressionMode(java.lang.String filename)
Get the effective compression mode.
|
static CompressionMode |
valueOf(java.lang.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.
|
java.io.InputStream |
wrapInput(java.io.InputStream in)
Wrap an input stream in a decompressor.
|
java.io.OutputStream |
wrapOutput(java.io.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(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String getCompressorName()
public CompressionMode getEffectiveCompressionMode(java.lang.String filename)
Get the effective compression mode. For AUTO, this auto-detects the appropriate mode from the file name.
filename - The filename to compress.AUTO.public java.io.OutputStream wrapOutput(java.io.OutputStream out)
throws java.io.IOException
Wrap an output stream in this compression mode.
out - The stream to wrapout.java.io.IOException - If there is an error setting up the compressor.java.lang.UnsupportedOperationException - if the mode is AUTO (use getEffectiveCompressionMode(String) first).public java.io.InputStream wrapInput(java.io.InputStream in)
throws java.io.IOException
Wrap an input stream in a decompressor.
in - The input stream.in and decompresses as appropriate.java.io.IOException - If there is an error setting up the decompressor.java.lang.UnsupportedOperationException - if the mode is AUTO (use getEffectiveCompressionMode(String) first).public static CompressionMode autodetect(java.lang.String name)
Auto-detect a compression mode from a file name.
name - The file name.AUTO.public static CompressionMode autodetect(java.io.File file)
Auto-detect a compression mode from a file’s name.
file - The file.AUTO.