public abstract class TIFFDecoder
extends java.lang.Object
decode()
method.
This class does all the work of storing decompressed data (given as a byte array) in the image object. Given the many variants (sample order, color depth, color space etc.) this is a larger portion of code.
Modifier and Type | Field and Description |
---|---|
private int |
bottomRow |
private int |
bufferIndex |
private TIFFCodec |
codec |
private int |
currentRow |
private TIFFImageFileDirectory |
ifd |
private int |
leftColumn |
private int |
processedTileRows |
private int |
rightColumn |
private byte[] |
rowBuffer |
private int |
tileIndex |
private int |
topRow |
private int |
totalTileRows |
Constructor and Description |
---|
TIFFDecoder() |
Modifier and Type | Method and Description |
---|---|
abstract void |
decode()
Decode data from input and write the decompressed pixel data to
the image associated with this decoder.
|
int |
getBytesPerRow()
Returns the number of bytes per row for the strip or tile
that this decoder deals with.
|
TIFFCodec |
getCodec()
Returns the codec from which this decoder is used.
|
abstract java.lang.Integer[] |
getCompressionTypes()
Returns an array with Integer values of all compression types supported by
this decoder (see the COMPRESSION_xyz constants in
TIFFConstants . |
TIFFImageFileDirectory |
getImageFileDirectory()
Returns the IFD for the image this decoder is supposed to uncompress
(partially).
|
java.io.DataInput |
getInput()
Returns the input stream from which this decoder is supposed
to read data.
|
int |
getTileIndex()
Returns the zero-based index of the tile or strip this decoder
is supposed to be decompressing.
|
int |
getX1()
Returns the leftmost column of the image strip / tile to be read
by this decoder.
|
int |
getX2()
Returns the rightmost column of the image strip / tile to be read
by this decoder.
|
int |
getY1()
Returns the top row of the image strip / tile to be read
by this decoder.
|
int |
getY2()
Returns the bottom row of the image strip / tile to be read
by this decoder.
|
void |
initialize()
Check if all necessary parameters have been given to this decoder
and initialize several internal fields from them.
|
void |
putBytes(byte[] data,
int offset,
int number)
Adds a number of bytes to the internal row buffer.
|
void |
setCodec(TIFFCodec tiffCodec)
Specify the codec to be used with this decoder.
|
void |
setImageFileDirectory(TIFFImageFileDirectory tiffIfd)
Specify the IFD to be used with this decoder.
|
void |
setTileIndex(int index)
Specify the zero-based tile index for the tile or strip to be decompressed
by this decoder.
|
private void |
storeRow(byte[] data,
int offset) |
private TIFFCodec codec
private TIFFImageFileDirectory ifd
private int currentRow
private int leftColumn
private int rightColumn
private int topRow
private int bottomRow
private byte[] rowBuffer
private int bufferIndex
private int tileIndex
private int processedTileRows
private int totalTileRows
public abstract void decode() throws InvalidFileStructureException, java.io.IOException
InvalidFileStructureException
java.io.IOException
public int getBytesPerRow()
public TIFFCodec getCodec()
public abstract java.lang.Integer[] getCompressionTypes()
TIFFConstants
.
Normally, this is only one value, but some compression types got assigned more than one constant
(e.g. deflated).
Also, a decoder could be capable of dealing with more than one type of compression
if the compression types are similar enough to justify that.
However, typically a decoder can only deal with one type of compression.public TIFFImageFileDirectory getImageFileDirectory()
public java.io.DataInput getInput()
public int getTileIndex()
public int getX1()
public int getX2()
public int getY1()
public int getY2()
public void initialize() throws java.io.IOException, MissingParameterException
java.io.IOException
MissingParameterException
public void putBytes(byte[] data, int offset, int number)
number
bytes
in data
.data
- byte array with image data that has been decodedoffset
- int index into data where the first byte to be stored is situatednumber
- int number of bytes to be storedpublic void setCodec(TIFFCodec tiffCodec)
initialize()
will throw an exception.tiffCodec
- TIFFCodec object to be used by this decodergetCodec()
public void setImageFileDirectory(TIFFImageFileDirectory tiffIfd)
initialize()
will throw an exception.tiffIfd
- object to be used by this decodergetImageFileDirectory()
public void setTileIndex(int index)
initialize()
will throw an exception.index
- zero-based tile / strip indexgetTileIndex()
private void storeRow(byte[] data, int offset)