public class CustomCompress extends Object
Stream header of deflated data:
Modifier and Type | Field and Description |
---|---|
static int |
MAGIC
Start of stream header for deflated data
|
Constructor and Description |
---|
CustomCompress() |
Modifier and Type | Method and Description |
---|---|
static int |
deflateToStream(byte[] input,
int inOff,
int inLen,
int level,
OutputStream out) |
static byte[] |
inflateFromStream(InputStream in) |
static byte[] |
inflateFromStream(InputStream in,
int inLen,
int outLen,
byte[] output,
int outOff) |
public static final int MAGIC
public static byte[] inflateFromStream(InputStream in) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
in
- InputStream
at start of stream header, i.e. position MAGIC
.IOException
- if an I/O or deflation exception occursIllegalArgumentException
- if inLen
≤ 0 or outLen
≤ 0, as read from headerArrayIndexOutOfBoundsException
public static byte[] inflateFromStream(InputStream in, int inLen, int outLen, byte[] output, int outOff) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
in
- InputStream
at start of deflated bytes, i.e. after the stream header.inLen
- number of deflated bytes in stream in
outLen
- number of inflated output
bytes at outOff
output
- sink for deflated bytesoutOff
- offset to output
output
for chainingIOException
- if an I/O or deflation exception occursArrayIndexOutOfBoundsException
- if outOff
and outLen
exceeds output
IllegalArgumentException
- if inLen
≤ 0 or outLen
≤ 0public static int deflateToStream(byte[] input, int inOff, int inLen, int level, OutputStream out) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
input
- raw input bytesinOff
- offset to input
inLen
- number of input
bytes at inOff
level
- compression level 0-9 or Deflater.DEFAULT_COMPRESSION
out
- sink for deflated bytesIOException
- if an I/O or deflation exception occursArrayIndexOutOfBoundsException
- if inOff
and inLen
exceeds input
IllegalArgumentException
- if inLen
≤ 0