public enum Compression extends java.lang.Enum<Compression>
Enum Constant and Description |
---|
BZIP2
bzip2 compression
|
GZIP
gzip compression
|
NONE
no compression
|
XZ
xz compression
|
ZIP
zip compression
|
Modifier and Type | Method and Description |
---|---|
static Compression |
byExtension(java.lang.String name)
Determines the compression type depending on the suffix of
name . |
static Compression |
forContentType(java.lang.String contentType)
Determines the compression type based on the content type (MIME type).
|
static org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream |
getBZip2InputStream(java.io.InputStream in)
Returns a Bzip2 input stream wrapping given input stream.
|
static java.io.OutputStream |
getCompressedFileOutputStream(java.io.File file)
Returns a compressing
OutputStream for the File file . |
java.io.OutputStream |
getCompressedOutputStream(java.io.OutputStream out)
Returns a compressing
OutputStream for out . |
static java.util.zip.GZIPInputStream |
getGZipInputStream(java.io.InputStream in)
Returns a Gzip input stream wrapping given input stream.
|
static java.io.InputStream |
getUncompressedFileInputStream(java.io.File file)
Returns an un-compressing
InputStream for the File file . |
java.io.InputStream |
getUncompressedInputStream(java.io.InputStream in)
Returns an un-compressing
InputStream for in . |
static org.apache.commons.compress.compressors.xz.XZCompressorInputStream |
getXZInputStream(java.io.InputStream in)
Returns a XZ input stream wrapping given input stream.
|
static java.util.zip.ZipInputStream |
getZipInputStream(java.io.InputStream in)
Returns a Zip input stream wrapping given input stream.
|
static Compression |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Compression[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Compression NONE
public static final Compression BZIP2
public static final Compression GZIP
public static final Compression ZIP
public static final Compression XZ
public static Compression[] values()
for (Compression c : Compression.values()) System.out.println(c);
public static Compression 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 Compression byExtension(java.lang.String name)
name
.name
- File name including extensionpublic static Compression forContentType(java.lang.String contentType)
contentType
- the content typepublic java.io.InputStream getUncompressedInputStream(java.io.InputStream in) throws java.io.IOException
InputStream
for in
.in
- raw input streamjava.io.IOException
- if any I/O error occurspublic static org.apache.commons.compress.compressors.xz.XZCompressorInputStream getXZInputStream(java.io.InputStream in) throws java.io.IOException
in
- The raw input streamnull
if in
is null
java.io.IOException
- if the given input stream does not contain valid BZ2 headerpublic static org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream getBZip2InputStream(java.io.InputStream in) throws java.io.IOException
in
- The raw input streamnull
if in
is null
java.io.IOException
- if the given input stream does not contain valid BZ2 headerUtils
, there since 7867)public static java.util.zip.GZIPInputStream getGZipInputStream(java.io.InputStream in) throws java.io.IOException
in
- The raw input streamnull
if in
is null
java.io.IOException
- if an I/O error has occurredUtils
, there since 7119)public static java.util.zip.ZipInputStream getZipInputStream(java.io.InputStream in) throws java.io.IOException
in
- The raw input streamnull
if in
is null
java.io.IOException
- if an I/O error has occurredUtils
, there since 7119)public static java.io.InputStream getUncompressedFileInputStream(java.io.File file) throws java.io.IOException
InputStream
for the File
file
.file
- filejava.io.IOException
- if any I/O error occurspublic java.io.OutputStream getCompressedOutputStream(java.io.OutputStream out) throws java.io.IOException
OutputStream
for out
.out
- raw output streamjava.io.IOException
- if any I/O error occurspublic static java.io.OutputStream getCompressedFileOutputStream(java.io.File file) throws java.io.IOException
OutputStream
for the File
file
.file
- filejava.io.IOException
- if any I/O error occursjava.nio.file.InvalidPathException
- if a Path object cannot be constructed from the abstract path