public abstract class Compression extends Object
Modifier and Type | Field and Description |
---|---|
static Compression |
BZIP2
A Compression object representing BZip2 compression.
|
static Compression |
COMPRESS
A Compression object representing Unix compress-type compression.
|
static Compression |
GZIP
A Compression object representing GZip compression.
|
static int |
MAGIC_SIZE
Number of bytes needed to determine compression type (magic number).
|
static Compression |
NONE
A Compression object representing no compression (or perhaps an
unknown one).
|
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
decompress(InputStream raw)
Returns a stream which is a decompressed version of the input stream,
according to this objects compression type.
|
static InputStream |
decompressStatic(InputStream raw)
Returns a decompressed version of the given input stream.
|
static Compression |
getCompression(byte[] magic)
Returns a Compression object characterising the compression (if any)
represented by a given magic number.
|
String |
toString()
Returns the name of this compression type.
|
public static final int MAGIC_SIZE
public static final Compression NONE
decompress
method will return the
raw input stream unchanged.public static final Compression GZIP
public static final Compression BZIP2
public static final Compression COMPRESS
public abstract InputStream decompress(InputStream raw) throws IOException
raw
- the raw input streamraw
IOException
public static Compression getCompression(byte[] magic)
magic
- a buffer containing the first MAGIC_SIZE
bytes of input of the stream to be characterisedCompression
object of the type represented by
magic
IllegalArgumentException
- if magic.length<MAGIC_SIZE
public static InputStream decompressStatic(InputStream raw) throws IOException
raw
- the raw input streamraw
IOException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.