|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jimi.core.util.Packbits
Packbits compression utility class.
Contains both unpack and packing method for the Macintosh Packbits compression standard.
Contains Variation for 16 bit RLE packing used in PICT files.
Contains a main() method with some test code for the pack unpack methods.
Constructor Summary | |
Packbits()
|
Method Summary | |
static int |
getAllRuns(byte[] inb)
Calculate length of every byte run in the input buffer and store into runb[] buffer. |
static int |
packbits(byte[] inb,
byte[] outb)
Compress input buffer using RLE packbits compression. |
static void |
unpackbits(byte[] inb,
byte[] outb)
Decompress an RLE compressed buffer of bytes as per format as described in source or in a document on TIFF packbits compression. |
static void |
unpackbits(byte[] inb,
int[] outb)
Variation for 16 bit RLE packing used in PICT files. |
static void |
unpackbits(byte[] inb,
int ini,
byte[] outb,
int outi,
int len)
More general. |
static void |
unpackbits(java.io.DataInputStream in,
byte[] outb)
|
static void |
unpackbitsLimit(byte[] inb,
int inbLen,
byte[] outb)
Variation for PICT - which provides short inb[] for a give outb[] This method when it exhausts input byte buffer it clears the remainder of the output buffer oub. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Packbits()
Method Detail |
public static void unpackbits(byte[] inb, int ini, byte[] outb, int outi, int len)
inb
- input bufferini
- where compressed data in input buffer startsoutb
- start output indexouti
- where to uncompress data to in output bufferlen
- length of the data after decompression.public static void unpackbitsLimit(byte[] inb, int inbLen, byte[] outb) throws java.lang.ArrayStoreException, java.lang.ArrayIndexOutOfBoundsException
public static void unpackbits(byte[] inb, byte[] outb) throws java.lang.ArrayStoreException, java.lang.ArrayIndexOutOfBoundsException
inb
- input buffer with compressed dataoutb
- output buffer for decompressed data
the length of the output buffer must be exact decompressed
lenght of compressed input.public static void unpackbits(byte[] inb, int[] outb) throws java.lang.ArrayStoreException, java.lang.ArrayIndexOutOfBoundsException
public static void unpackbits(java.io.DataInputStream in, byte[] outb) throws java.lang.ArrayStoreException, java.lang.ArrayIndexOutOfBoundsException, java.io.IOException
in
- data input stream to read packbits data stream fromoutb
- byte buffer to place unpacked byte data to.
It is assumed that unpackbits is called with outb big enough
for a single sequence of compressed bytespublic static int getAllRuns(byte[] inb)
inb
- raw data to calculate byte runs onruns
- output to contain length of each byterun
this buffer must be as long as input buffer
to handle worst case.public static int packbits(byte[] inb, byte[] outb) throws java.lang.ArrayStoreException, java.lang.ArrayIndexOutOfBoundsException
inb
- input buffer containing bytes to be compressed
using RLE packbits algorithm. buffer is assumed
to be completely filled.outb
- output buffer containing compressed data.
This must be large enough for worst case compression
of input buffer. [ worst case is 1 additional byte
for every 128 bytes of input buffer with a minimum
size of 2 bytes ]Example Input buffer. 03 04 05 05 06 07 08 Example Stoopid encoding 01 03 04 -01 05 02 06 07 08 Example Proper encoding 06 03 04 05 05 06 07 08
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |