|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream jwo.utils.gifutils.BitInputStream jwo.utils.gifutils.GIFInputStream
public class GIFInputStream
GIFInputStream provides readXXX() methods useful for reading in the contents of a GIF file. Included are methods which handle LZW decompression of the image data.
Field Summary | |
---|---|
static int |
MAXIMUM_CODE_LENGTH
Maximum code size in bits for GIF LZW decompression |
protected jwo.utils.gifutils.LZWStringTable |
stringTable
String table for LZW decompression |
Fields inherited from class jwo.utils.gifutils.BitInputStream |
---|
cachedBits, numCachedBits |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
GIFInputStream(InputStream is)
Creates an input stream suitable for reading .gif files. |
Method Summary | |
---|---|
byte |
readByte()
Reads an 8 bit byte at the current bit boundary. |
protected short |
readCode(BitInputStream bis)
Reads a code from the given BitInputStream using the code size from the instance LZW string table. |
Color |
readColor()
Reads 3 bytes and interprets them as an RRGGBB hex color. |
byte[] |
readDataBlock()
Reads data sub-blocks from the underlying input stream until a block terminator (a single zero byte) is encountered. |
byte[] |
readDataSubBlock()
Reads a data sub-block from the underlying stream. |
byte[] |
readImageData(int length)
Reads the compressed data for a table-based image and return the decompressed raster data. |
int |
readWord()
Reads an unsigned LSB-first 16 byte word from the underlying stream. |
Methods inherited from class jwo.utils.gifutils.BitInputStream |
---|
read, readBit, readBits |
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MAXIMUM_CODE_LENGTH
protected jwo.utils.gifutils.LZWStringTable stringTable
Constructor Detail |
---|
public GIFInputStream(InputStream is)
is
- Underlying input stream.Method Detail |
---|
public byte readByte() throws IOException
IOException
- if 8 bits are not available.public int readWord() throws IOException
IOException
- if EOF is reached before 2 bytes are read.public Color readColor() throws IOException
IOException
- if EOF is reached before 3 bytes are read.public byte[] readDataSubBlock() throws IOException
IOException
- if a complete block is not read before EOFpublic byte[] readDataBlock() throws IOException
IOException
- if a complete block is not read before EOFprotected short readCode(BitInputStream bis) throws IOException
IOException
- if a code is not read before EOFpublic byte[] readImageData(int length) throws IOException
length
- Amount of data to read in bytes.
IOException
- if EOF is reached prematurely
or the LZW decoding fails
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |