TIFFDirectory
instance corresponds
to an IFD and contains a set of TIFFField
s each of which
corresponds to an IFD Entry in the IFD.
When reading, a TIFFDirectory
may be created by passing
the value returned by ImageReader.
to createFromMetadata()
. The TIFFField
s in the directory may then
be obtained using the accessor methods provided in this class.
When writing, an IIOMetadata
object for use by one of the
write()
methods of javax.
may be
created from a TIFFDirectory
by getAsMetadata()
.
The TIFFDirectory
itself may be created by construction or
from the IIOMetadata
object returned by
ImageWriter.
. The TIFFField
s in the
directory may be set using the mutator methods provided in this class.
A TIFFDirectory
is aware of the tag numbers in the
group of TIFFTagSet
s associated with it. When
a TIFFDirectory
is created from a native image metadata
object, these tag sets are derived from the tagSets
attribute
of the TIFFIFD
node.
A TIFFDirectory
might also have a parent TIFFTag
.
This will occur if the directory represents an IFD other than the root
IFD of the image. The parent tag is the tag of the IFD Entry which is a
pointer to the IFD represented by this TIFFDirectory
. The
TIFFTag#isIFDPointer
method of this parent TIFFTag
must return true
. When a TIFFDirectory
is
created from a native image metadata object, the parent tag set is set
from the parentTagName
attribute of the corresponding
TIFFIFD
node. Note that a TIFFDirectory
instance
which has a non-null
parent tag will be contained in the
data field of a TIFFField
instance which has a tag field
equal to the contained directory's parent tag.
As an example consider an Exif image. The TIFFDirectory
instance corresponding to the Exif IFD in the Exif stream would have parent
tag TAG_EXIF_IFD_POINTER
and would include ExifTIFFTagSet
in its group of known tag sets.
The TIFFDirectory
corresponding to this Exif IFD will be
contained in the data field of a TIFFField
which will in turn
be contained in the TIFFDirectory
corresponding to the primary
IFD of the Exif image which will itself have a null
-valued
parent tag.
Note that this implementation is not synchronized. If multiple
threads use a TIFFDirectory
instance concurrently, and at
least one of the threads modifies the directory, for example, by adding
or removing TIFFField
s or TIFFTagSet
s, it
must be synchronized externally.
IIOMetadata
, TIFFField
, TIFFTag
, TIFFTagSet
Modifier and Type | Field and Description |
---|---|
private Map | highFields
A mapping of |
private TIFFField[] | lowFields
The fields in this directory which have a low tag number. |
private static final int | MAX_LOW_FIELD_TAG_NUM
The largest low-valued tag number in the TIFF 6.0 specification. |
private int | numLowFields
The number of low tag numbered fields in the directory. |
private TIFFTag | parentTag
The parent |
private List | tagSets
The |
Access | Constructor and Description |
---|---|
public | TIFFDirectory(TIFFTagSet[]
The tagSets, TIFFTag TIFFTagSets associated with this
directory.The parent parentTag)TIFFTag of this directory;
may be null .Constructs a |
Modifier and Type | Method and Description |
---|---|
public void | addTagSet(TIFFTagSet
The tagSet)TIFFTagSet to add.Adds an element to the group of |
public void | |
public TIFFDirectory | Returns: A clone of thisTIFFDirectory .Overrides java. Clones the directory and all the fields contained therein. |
public boolean | containsTIFFField(int
The tag number. tagNumber)Determines whether a TIFF field with the given tag number is contained in this directory. |
public static TIFFDirectory | Returns: ATIFFDirectory populated from the contents of
the supplied metadata object.A metadata object which supports a compatible
image metadata format. tiffImageMetadata)Creates a |
public IIOMetadata | Returns: A metadata instance initialized from the contents of thisTIFFDirectory .Converts the directory to a metadata object. |
public int | Returns: The number ofTIFFField s in this
TIFFDirectory .Returns the number of |
public TIFFTag | Returns: The parentTIFFTag of this
TIFFDiectory or null .Returns the parent |
public TIFFTag | Returns: The correspondingTIFFTag or null .The tag number of interest. tagNumber)Returns the |
public TIFFTagSet[] | Returns: TheTIFFTagSet s associated with this
TIFFDirectory .Returns the |
public TIFFField | Returns: ATIFFField with the requested tag number of
null if no such field is present.The tag number of the tag associated with the field. tagNumber)Retrieves a TIFF field from the directory. |
public TIFFField[] | Returns: An array of all TIFF fields in order of numerically increasing tag number.Retrieves all TIFF fields from the directory. |
public void | removeTagSet(TIFFTagSet
The tagSet)TIFFTagSet to remove.Removes an element from the group of |
public void | removeTIFFField(int
The tag number of the tag associated with the field. tagNumber)Removes a TIFF field from the directory. |
public void |
highFields | back to summary |
---|---|
private Map<Integer, TIFFField> highFields A mapping of |
lowFields | back to summary |
---|---|
private TIFFField[] lowFields The fields in this directory which have a low tag number. These are managed as an array for efficiency as they are the most common fields. |
MAX_LOW_FIELD_TAG_NUM | back to summary |
---|---|
private static final int MAX_LOW_FIELD_TAG_NUM The largest low-valued tag number in the TIFF 6.0 specification. |
numLowFields | back to summary |
---|---|
private int numLowFields The number of low tag numbered fields in the directory. |
parentTag | back to summary |
---|---|
private TIFFTag parentTag The parent |
tagSets | back to summary |
---|---|
private List<TIFFTagSet> tagSets The |
TIFFDirectory | back to summary |
---|---|
public TIFFDirectory(TIFFTagSet[] tagSets, TIFFTag parentTag) Constructs a
|
addTagSet | back to summary |
---|---|
public void addTagSet(TIFFTagSet tagSet) Adds an element to the group of
|
addTIFFField | back to summary |
---|---|
public void addTIFFField(TIFFField f) Adds a TIFF field to the directory.
|
clone | back to summary |
---|---|
public TIFFDirectory clone() throws CloneNotSupportedException Overrides java. Clones the directory and all the fields contained therein.
|
containsTIFFField | back to summary |
---|---|
public boolean containsTIFFField(int tagNumber) Determines whether a TIFF field with the given tag number is contained in this directory.
|
createFromMetadata | back to summary |
---|---|
public static TIFFDirectory createFromMetadata(IIOMetadata tiffImageMetadata) throws IIOInvalidTreeException Creates a
|
getAsMetadata | back to summary |
---|---|
public IIOMetadata getAsMetadata() Converts the directory to a metadata object.
|
getNumTIFFFields | back to summary |
---|---|
public int getNumTIFFFields() Returns the number of
|
getParentTag | back to summary |
---|---|
public TIFFTag getParentTag() Returns the parent
|
getTag | back to summary |
---|---|
public TIFFTag getTag(int tagNumber) Returns the
|
getTagSets | back to summary |
---|---|
public TIFFTagSet[] getTagSets() Returns the
|
getTIFFField | back to summary |
---|---|
public TIFFField getTIFFField(int tagNumber) Retrieves a TIFF field from the directory.
|
getTIFFFields | back to summary |
---|---|
public TIFFField[] getTIFFFields() Retrieves all TIFF fields from the directory.
|
removeTagSet | back to summary |
---|---|
public void removeTagSet(TIFFTagSet tagSet) Removes an element from the group of
|
removeTIFFField | back to summary |
---|---|
public void removeTIFFField(int tagNumber) Removes a TIFF field from the directory.
|
removeTIFFFields | back to summary |
---|---|
public void removeTIFFFields() Removes all TIFF fields from the directory. |