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 headerArrayIndexOutOfBoundsExceptionpublic 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 inoutLen - number of inflated output bytes at outOffoutput - sink for deflated bytesoutOff - offset to outputoutput for chainingIOException - if an I/O or deflation exception occursArrayIndexOutOfBoundsException - if outOff and outLen exceeds outputIllegalArgumentException - 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 inputinLen - number of input bytes at inOfflevel - compression level 0-9 or Deflater.DEFAULT_COMPRESSIONout - sink for deflated bytesIOException - if an I/O or deflation exception occursArrayIndexOutOfBoundsException - if inOff and inLen exceeds inputIllegalArgumentException - if inLen ≤ 0