Top Description Fields Constructors Methods
com.jogamp.common.util

public Class CustomCompress

extends Object
Class Inheritance
Imports
java.io.DataInputStream, .DataOutputStream, .IOException, .InputStream, .OutputStream, java.util.zip.DataFormatException, .Deflater, .Inflater

All in memory inflater / deflator for small chunks using streams

Stream header of deflated data:

Field Summary

Modifier and TypeField and Description
public static final int
MAGIC

Start of stream header for deflated data

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int

Returns:

number of deflated bytes written, not including the header.
deflateToStream
(final byte[]
raw input bytes
input
,
final int
offset to input
inOff
,
final int
number of input bytes at inOff
inLen
,
final int
compression level 0-9 or Deflater#DEFAULT_COMPRESSION
level
,
final OutputStream
sink for deflated bytes
out
)

public static byte[]

Returns:

the inflated bytes from the stream
inflateFromStream
(final InputStream
InputStream at start of stream header, i.e. position MAGIC.
in
)

public static byte[]

Returns:

the inflated bytes from the stream, passing output for chaining
inflateFromStream
(final InputStream
InputStream at start of deflated bytes, i.e. after the stream header.
in
,
final int
number of deflated bytes in stream in
inLen
,
final int
number of inflated output bytes at outOff
outLen
,
final byte[]
sink for deflated bytes
output
,
final int
offset to output
outOff
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAGICback to summary
public static final int MAGIC

Start of stream header for deflated data

Constructor Detail

CustomCompressback to summary
public CustomCompress()

Method Detail

deflateToStreamback to summary
public static int deflateToStream(final byte[] input, final int inOff, final int inLen, final int level, final OutputStream out) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
Parameters
input:byte[]

raw input bytes

inOff:int

offset to input

inLen:int

number of input bytes at inOff

level:int

compression level 0-9 or Deflater#DEFAULT_COMPRESSION

out:OutputStream

sink for deflated bytes

Returns:int

number of deflated bytes written, not including the header.

Exceptions
IOException:
if an I/O or deflation exception occurs
ArrayIndexOutOfBoundsException:
if inOff and inLen exceeds input
IllegalArgumentException:
if inLen ≤ 0
inflateFromStreamback to summary
public static byte[] inflateFromStream(final InputStream in) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
Parameters
in:InputStream

InputStream at start of stream header, i.e. position MAGIC.

Returns:byte[]

the inflated bytes from the stream

Exceptions
IOException:
if an I/O or deflation exception occurs
IllegalArgumentException:
if inLen ≤ 0 or outLen ≤ 0, as read from header
inflateFromStreamback to summary
public static byte[] inflateFromStream(final InputStream in, final int inLen, final int outLen, final byte[] output, final int outOff) throws IOException, ArrayIndexOutOfBoundsException, IllegalArgumentException
Parameters
in:InputStream

InputStream at start of deflated bytes, i.e. after the stream header.

inLen:int

number of deflated bytes in stream in

outLen:int

number of inflated output bytes at outOff

output:byte[]

sink for deflated bytes

outOff:int

offset to output

Returns:byte[]

the inflated bytes from the stream, passing output for chaining

Exceptions
IOException:
if an I/O or deflation exception occurs
ArrayIndexOutOfBoundsException:
if outOff and outLen exceeds output
IllegalArgumentException:
if inLen ≤ 0 or outLen ≤ 0