public enum FileType extends java.lang.Enum<FileType>
findType(java.lang.String) determines the compression type by the given extension.
Compression can also be zero-compression, which is currently provided by
the PLAIN and JSON enums.
| Modifier and Type | Method and Description |
|---|---|
byte[] |
compress(byte[] bytes)
Compresses the given bytes in memory and returns the compressed bytes.
|
java.io.OutputStream |
compress(java.io.OutputStream os)
Compresses the given InputStream and returns an OutputStream.
|
byte[] |
decompress(byte[] bytes)
Decompresses the given bytes in memory and returns the decompressed bytes.
|
java.io.InputStream |
decompress(java.io.InputStream is)
Decompresses the given InputStream and returns an OutputStream.
|
static FileType |
findType(java.lang.String ext)
Returns
valueOf or the default enum PLAIN, i.e.,
this method doesn't throw any exceptions and allways returns a valid enum. |
java.io.InputStream |
inputStream(java.io.InputStream is)
Return the appropriate input stream.
|
java.io.OutputStream |
outputStream(java.io.OutputStream os)
Return the appropriate output stream.
|
static FileType |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static FileType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final FileType BZ2
public static final FileType GZ
public static final FileType JSON
public static final FileType PLAIN
public static final FileType XZ
public static FileType[] values()
for (FileType c : FileType.values()) System.out.println(c);
public static FileType 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 static FileType findType(java.lang.String ext)
valueOf or the default enum PLAIN, i.e.,
this method doesn't throw any exceptions and allways returns a valid enum.public java.io.InputStream inputStream(java.io.InputStream is)
throws java.lang.Exception
java.lang.Exceptionpublic java.io.OutputStream outputStream(java.io.OutputStream os)
throws java.lang.Exception
java.lang.Exceptionpublic byte[] compress(byte[] bytes)
throws java.lang.Exception
java.lang.Exceptionpublic java.io.OutputStream compress(java.io.OutputStream os)
throws java.lang.Exception
java.lang.Exceptionpublic java.io.InputStream decompress(java.io.InputStream is)
throws java.lang.Exception
java.lang.Exceptionpublic byte[] decompress(byte[] bytes)
throws java.lang.Exception
java.lang.Exception