public class TIFFDirectory
extends java.lang.Object
implements java.io.Serializable
A TIFF IFD consists of a set of TIFFField tags. Methods are provided to query the set of tags and to obtain the raw field array. In addition, convenience methods are provided for acquiring the values of tags that contain a single value that fits into a byte, int, long, float, or double.
Every TIFF file is made up of one or more public IFDs that are joined in a linked list, rooted in the file header. A file may also contain so-called private IFDs that are referenced from tag data and do not appear in the main list.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
TIFFField
,
Serialized FormModifier and Type | Field and Description |
---|---|
(package private) java.util.Map |
fieldIndex
A Hashtable indexing the fields by tag number.
|
(package private) TIFFField[] |
fields
An array of TIFFFields.
|
(package private) long |
ifdOffset
The offset of this IFD.
|
(package private) boolean |
isBigEndian
A boolean storing the endianness of the stream.
|
(package private) long |
nextIFDOffset
The offset of the next IFD.
|
(package private) int |
numEntries
The number of entries in the IFD.
|
private static long |
serialVersionUID |
private static int[] |
SIZE_OF_TYPE |
Constructor and Description |
---|
TIFFDirectory()
The default constructor.
|
TIFFDirectory(SeekableStream stream,
int directory)
Constructs a TIFFDirectory from a SeekableStream.
|
TIFFDirectory(SeekableStream stream,
long ifdOffset,
int directory)
Constructs a TIFFDirectory by reading a SeekableStream.
|
Modifier and Type | Method and Description |
---|---|
TIFFField |
getField(int tag)
Returns the value of a given tag as a TIFFField,
or null if the tag is not present.
|
byte |
getFieldAsByte(int tag)
Returns the value of index 0 of a given tag as a
byte.
|
byte |
getFieldAsByte(int tag,
int index)
Returns the value of a particular index of a given tag as a
byte.
|
double |
getFieldAsDouble(int tag)
Returns the value of index 0 of a given tag as a double.
|
double |
getFieldAsDouble(int tag,
int index)
Returns the value of a particular index of a given tag as a
double.
|
float |
getFieldAsFloat(int tag)
Returns the value of index 0 of a given tag as a float.
|
float |
getFieldAsFloat(int tag,
int index)
Returns the value of a particular index of a given tag as a
float.
|
long |
getFieldAsLong(int tag)
Returns the value of index 0 of a given tag as a
long.
|
long |
getFieldAsLong(int tag,
int index)
Returns the value of a particular index of a given tag as a
long.
|
TIFFField[] |
getFields()
Returns an array of TIFFFields containing all the fields
in this directory.
|
long |
getIFDOffset()
Returns the offset of the IFD corresponding to this
TIFFDirectory . |
long |
getNextIFDOffset()
Returns the offset of the next IFD after the IFD corresponding to this
TIFFDirectory . |
static int |
getNumDirectories(SeekableStream stream)
Returns the number of image directories (subimages) stored in a
given TIFF file, represented by a
SeekableStream . |
int |
getNumEntries()
Returns the number of directory entries.
|
int[] |
getTags()
Returns an ordered array of ints indicating the tag
values.
|
private void |
initialize(SeekableStream stream) |
boolean |
isBigEndian()
Returns a boolean indicating whether the byte order used in the
the TIFF file is big-endian.
|
boolean |
isTagPresent(int tag)
Returns true if a tag appears in the directory.
|
private static boolean |
isValidEndianTag(int endian) |
private double |
readDouble(SeekableStream stream) |
private float |
readFloat(SeekableStream stream) |
private int |
readInt(SeekableStream stream) |
private short |
readShort(SeekableStream stream) |
private long |
readUnsignedInt(SeekableStream stream) |
private static long |
readUnsignedInt(SeekableStream stream,
boolean isBigEndian) |
private int |
readUnsignedShort(SeekableStream stream) |
private static int |
readUnsignedShort(SeekableStream stream,
boolean isBigEndian) |
private static final long serialVersionUID
boolean isBigEndian
int numEntries
TIFFField[] fields
java.util.Map fieldIndex
long ifdOffset
long nextIFDOffset
private static final int[] SIZE_OF_TYPE
TIFFDirectory()
public TIFFDirectory(SeekableStream stream, int directory) throws java.io.IOException
stream
- a SeekableStream to read from.directory
- the index of the directory to read.java.io.IOException
public TIFFDirectory(SeekableStream stream, long ifdOffset, int directory) throws java.io.IOException
stream
- a SeekableStream to read from.ifdOffset
- the long byte offset of the directory.directory
- the index of the directory to read beyond the
one at the current stream offset; zero indicates the IFD
at the current offset.java.io.IOException
private static boolean isValidEndianTag(int endian)
private void initialize(SeekableStream stream) throws java.io.IOException
java.io.IOException
public int getNumEntries()
public TIFFField getField(int tag)
public boolean isTagPresent(int tag)
public int[] getTags()
public TIFFField[] getFields()
public byte getFieldAsByte(int tag, int index)
public byte getFieldAsByte(int tag)
public long getFieldAsLong(int tag, int index)
public long getFieldAsLong(int tag)
public float getFieldAsFloat(int tag, int index)
public float getFieldAsFloat(int tag)
public double getFieldAsDouble(int tag, int index)
public double getFieldAsDouble(int tag)
private short readShort(SeekableStream stream) throws java.io.IOException
java.io.IOException
private int readUnsignedShort(SeekableStream stream) throws java.io.IOException
java.io.IOException
private int readInt(SeekableStream stream) throws java.io.IOException
java.io.IOException
private long readUnsignedInt(SeekableStream stream) throws java.io.IOException
java.io.IOException
private float readFloat(SeekableStream stream) throws java.io.IOException
java.io.IOException
private double readDouble(SeekableStream stream) throws java.io.IOException
java.io.IOException
private static int readUnsignedShort(SeekableStream stream, boolean isBigEndian) throws java.io.IOException
java.io.IOException
private static long readUnsignedInt(SeekableStream stream, boolean isBigEndian) throws java.io.IOException
java.io.IOException
public static int getNumDirectories(SeekableStream stream) throws java.io.IOException
SeekableStream
.java.io.IOException
public boolean isBigEndian()
public long getIFDOffset()
TIFFDirectory
.public long getNextIFDOffset()
TIFFDirectory
.