|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLZWEncoder
public class LZWEncoder
Adapted from Jef Poskanzer's Java port by way of J. M. G. Elliott.
Field Summary | |
---|---|
(package private) int |
a_count
Number of characters so far in this 'packet'. |
(package private) byte[] |
accum
Define the storage for the packet accumulator. |
(package private) static int |
BITS
DEFINE BITS AS 12. |
(package private) boolean |
clear_flg
block compression parameters -- after all codes are used up, and compression rate changes, start over. |
(package private) int |
ClearCode
Integer representing the clear code. |
(package private) int[] |
codetab
Integer Array of size HSIZE. |
(package private) int |
cur_accum
Integer representing the Current Accumulation. |
(package private) int |
cur_bits
Integer representing the Current Bits. |
int |
curPixel
Integer representing current pixel. |
static int |
EOF
Integer representing End Of File value. |
(package private) int |
EOFCode
Integer representing the EOF code. |
(package private) int |
free_ent
first unused entry. |
(package private) int |
g_init_bits
Integer. |
(package private) int |
hsize
for dynamic table sizing. |
(package private) static int |
HSIZE
DEFINE HSIZE AS 5003. |
(package private) int[] |
htab
Integer Array of size HSIZE. |
int |
imgH
Integer representing image Height. |
int |
imgW
Integer representing image Width. |
private int |
initCodeSize
Integer representing initial Code Size. |
(package private) int[] |
masks
An array of hex masks. |
(package private) int |
maxbits
user settable max # bits/code. |
(package private) int |
maxcode
maximum code, given n_bits. |
(package private) int |
maxmaxcode
should NEVER generate this code. |
(package private) int |
n_bits
number of bits/code. |
private byte[] |
pixAry
Byte array representing the pixel color values. |
int |
remaining
Integer representing remaining pixels. |
Constructor Summary | |
---|---|
LZWEncoder(int width,
int height,
byte[] pixels,
int color_depth)
This is the constructor for the LZWEncoder class. |
Method Summary | |
---|---|
(package private) void |
char_out(byte c,
java.io.OutputStream outs)
Add a character to the end of the current packet, and if it is 254 characters, flush the packet to disk. |
(package private) void |
cl_block(java.io.OutputStream outs)
Clear out the hash table table clear for block compress. |
(package private) void |
cl_hash(int hsize)
Reset code table. |
(package private) void |
compress(int init_bits,
java.io.OutputStream outs)
Compress code table. |
(package private) void |
encode(java.io.OutputStream os)
This method does the encoding and sends to an output stream. |
(package private) void |
flush_char(java.io.OutputStream outs)
Flush the packet to disk, and reset the accumulator. |
(package private) int |
MAXCODE(int n_bits)
This method returns the Max Code given the number of bits. |
int |
nextPixel()
Return the next pixel from the image. |
(package private) void |
output(int code,
java.io.OutputStream outs)
This method produces the output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EOF
public int imgW
public int imgH
private byte[] pixAry
private int initCodeSize
public int remaining
public int curPixel
static final int BITS
static final int HSIZE
int n_bits
int maxbits
int maxcode
int maxmaxcode
int[] htab
int[] codetab
int hsize
int free_ent
boolean clear_flg
int g_init_bits
int ClearCode
int EOFCode
int cur_accum
int cur_bits
int[] masks
int a_count
byte[] accum
Constructor Detail |
---|
LZWEncoder(int width, int height, byte[] pixels, int color_depth)
width
- int representing widthheight
- int representing heightpixels
- byte array representing the picture color codescolor_depth
- int representing color depthMethod Detail |
---|
void char_out(byte c, java.io.OutputStream outs) throws java.io.IOException
c
- a single byteouts
- output stream
java.io.IOException
void cl_block(java.io.OutputStream outs) throws java.io.IOException
outs
- OutputStream object
java.io.IOException
void cl_hash(int hsize)
hsize
- an int representing the hash table sizevoid compress(int init_bits, java.io.OutputStream outs) throws java.io.IOException
outs
- OutputStream objectinit_bits
- int representing the init bits
java.io.IOException
void encode(java.io.OutputStream os) throws java.io.IOException
os
- OutputStream object
java.io.IOException
void flush_char(java.io.OutputStream outs) throws java.io.IOException
outs
- OutputStream object
java.io.IOException
final int MAXCODE(int n_bits)
n_bits
- integer representing the number of bits
public int nextPixel()
void output(int code, java.io.OutputStream outs) throws java.io.IOException
code
- an integer representing the codeouts
- OutputStream object
java.io.IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |