Class TIFFTag
public class TIFFTag extends Object
The actual tag values used in the root IFD of a standard ("baseline") tiff stream are defined in the BaselineTIFFTagSet
class.
- Since:
- 9
- See Also:
Field Summary
Modifier and Type | Field | Description |
---|---|---|
static final int |
MAX_DATATYPE |
The numerically largest constant representing a TIFF data type. |
static final int |
MIN_DATATYPE |
The numerically smallest constant representing a TIFF data type. |
static final int |
TIFF_ASCII |
Flag for null-terminated ASCII strings. |
static final int |
TIFF_BYTE |
Flag for 8 bit unsigned integers. |
static final int |
TIFF_DOUBLE |
Flag for 64 bit IEEE doubles. |
static final int |
TIFF_FLOAT |
Flag for 32 bit IEEE floats. |
static final int |
TIFF_IFD_POINTER |
Flag for IFD pointer defined in TIFF Tech Note 1 in TIFF Specification Supplement 1. |
static final int |
TIFF_LONG |
Flag for 32 bit unsigned integers. |
static final int |
TIFF_RATIONAL |
Flag for pairs of 32 bit unsigned integers. |
static final int |
TIFF_SBYTE |
Flag for 8 bit signed integers. |
static final int |
TIFF_SHORT |
Flag for 16 bit unsigned integers. |
static final int |
TIFF_SLONG |
Flag for 32 bit signed integers. |
static final int |
TIFF_SRATIONAL |
Flag for pairs of 32 bit signed integers. |
static final int |
TIFF_SSHORT |
Flag for 16 bit signed integers. |
static final int |
TIFF_UNDEFINED |
Flag for 8 bit uninterpreted bytes. |
static final String |
UNKNOWN_TAG_NAME |
The name assigned to a tag with an unknown tag number. |
Constructor Summary
Constructor | Description |
---|---|
TIFFTag |
Constructs a TIFFTag with a given name, tag number, and set of legal data types. |
TIFFTag |
Constructs a TIFFTag with a given name, tag number, set of legal data types, and value count. |
TIFFTag |
Constructs a TIFFTag with a given name, tag number and TIFFTagSet to which it refers. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
protected void |
addValueName |
Adds a mnemonic name for a particular value that this tag's data may take on. |
int |
getCount() |
Returns the value count of this tag. |
int |
getDataTypes() |
Returns a bit mask indicating the set of data types that may be used to store the data associated with the tag. |
String |
getName() |
Returns the name of the tag, as it will appear in image metadata. |
int[] |
getNamedValues() |
Returns an array of values for which mnemonic names are defined. |
int |
getNumber() |
Returns the integer used to represent the tag. |
static int |
getSizeOfType |
Returns the number of bytes used to store a value of the given data type. |
TIFFTagSet |
getTagSet() |
Returns the TIFFTagSet of which this tag is a part. |
String |
getValueName |
Returns the mnemonic name associated with a particular value that this tag's data may take on, or null if no name is present. |
boolean |
hasValueNames() |
Returns true if there are mnemonic names associated with the set of legal values for the data associated with this tag. |
boolean |
isDataTypeOK |
Returns true if the given data type may be used for the data associated with this tag. |
boolean |
isIFDPointer() |
Returns true if this tag is used to point to an IFD structure containing additional tags. |
Field Details
TIFF_BYTE
public static final int TIFF_BYTE
- See Also:
TIFF_ASCII
public static final int TIFF_ASCII
- See Also:
TIFF_SHORT
public static final int TIFF_SHORT
- See Also:
TIFF_LONG
public static final int TIFF_LONG
- See Also:
TIFF_RATIONAL
public static final int TIFF_RATIONAL
- See Also:
TIFF_SBYTE
public static final int TIFF_SBYTE
- See Also:
TIFF_UNDEFINED
public static final int TIFF_UNDEFINED
- See Also:
TIFF_SSHORT
public static final int TIFF_SSHORT
- See Also:
TIFF_SLONG
public static final int TIFF_SLONG
- See Also:
TIFF_SRATIONAL
public static final int TIFF_SRATIONAL
- See Also:
TIFF_FLOAT
public static final int TIFF_FLOAT
- See Also:
TIFF_DOUBLE
public static final int TIFF_DOUBLE
- See Also:
TIFF_IFD_POINTER
public static final int TIFF_IFD_POINTER
- See Also:
MIN_DATATYPE
public static final int MIN_DATATYPE
- See Also:
MAX_DATATYPE
public static final int MAX_DATATYPE
- See Also:
UNKNOWN_TAG_NAME
public static final String UNKNOWN_TAG_NAME
TIFFTagSet
s known to the reader.- See Also:
Constructor Details
TIFFTag
public TIFFTag(String name, int number, int dataTypes, int count)
TIFFTag
with a given name, tag number, set of legal data types, and value count. A negative value count signifies that either an arbitrary number of values is legal or the required count is determined by the values of other fields in the IFD. A non-negative count specifies the number of values which an associated field must contain. The tag will have no associated TIFFTagSet
. If there are mnemonic names to be associated with the legal data values for the tag, addValueName()
should be called on the new instance for each name. Mnemonic names apply only to tags which have integral data type.
See the documentation for getDataTypes()
for an explanation of how the set of data types is to be converted into a bit mask.
- Parameters:
-
name
- the name of the tag. -
number
- the number used to represent the tag. -
dataTypes
- a bit mask indicating the set of legal data types for this tag. -
count
- the value count for this tag. - Throws:
-
NullPointerException
- if name is null. -
IllegalArgumentException
- if number is negative or dataTypes is negative or specifies an out of range type.
TIFFTag
public TIFFTag(String name, int number, TIFFTagSet tagSet)
TIFFTag
with a given name, tag number and TIFFTagSet
to which it refers. The legal data types are set to include TIFF_LONG
and TIFF_IFD_POINTER
and the value count is unity. The TIFFTagSet
will represent the set of TIFFTag
s which appear in the IFD pointed to. A TIFFTag
represents an IFD pointer if and only if tagSet
is non-null
or the data type TIFF_IFD_POINTER
is legal.- Parameters:
-
name
- the name of the tag. -
number
- the number used to represent the tag. -
tagSet
- theTIFFTagSet
to which this tag belongs. - Throws:
-
NullPointerException
- if name or tagSet is null. -
IllegalArgumentException
- if number is negative. - See Also:
TIFFTag
public TIFFTag(String name, int number, int dataTypes)
TIFFTag
with a given name, tag number, and set of legal data types. The value count of the tag will be undefined and it will have no associated TIFFTagSet
.- Parameters:
-
name
- the name of the tag. -
number
- the number used to represent the tag. -
dataTypes
- a bit mask indicating the set of legal data types for this tag. - Throws:
-
NullPointerException
- if name is null. -
IllegalArgumentException
- if number is negative or dataTypes is negative or specifies an out of range type. - See Also:
Method Details
getSizeOfType
public static int getSizeOfType(int dataType)
- Parameters:
-
dataType
- the data type to be queried. - Returns:
- the number of bytes used to store the given data type.
- Throws:
-
IllegalArgumentException
- ifdatatype
is less thanMIN_DATATYPE
or greater thanMAX_DATATYPE
.
getName
public String getName()
- Returns:
- the tag name, as a
String
.
getNumber
public int getNumber()
- Returns:
- the tag number, as an
int
.
getDataTypes
public int getDataTypes()
(1 << TIFFTag.TIFF_SHORT) | (1 << TIFFTag.TIFF_LONG)
- Returns:
- an
int
containing a bitmask encoding the set of valid data types.
getCount
public int getCount()
TIFFField
which has this tag. If the value is negative, the count is undefined. In the latter case the count may be derived, e.g., the number of values of the BitsPerSample
field is SamplesPerPixel
, or it may be variable as in the case of most US-ASCII
fields.- Returns:
- the value count of this tag.
isDataTypeOK
public boolean isDataTypeOK(int dataType)
true
if the given data type may be used for the data associated with this tag.- Parameters:
-
dataType
- the data type to be queried, one ofTIFF_BYTE
,TIFF_SHORT
, etc. - Returns:
- a
boolean
indicating whether the given data type may be used with this tag. - Throws:
-
IllegalArgumentException
- ifdatatype
is less thanMIN_DATATYPE
or greater thanMAX_DATATYPE
.
getTagSet
public TIFFTagSet getTagSet()
TIFFTagSet
of which this tag is a part.- Returns:
- the containing
TIFFTagSet
.
isIFDPointer
public boolean isIFDPointer()
true
if this tag is used to point to an IFD structure containing additional tags. A TIFFTag
represents an IFD pointer if and only if its TIFFTagSet
is non-null
or the data type TIFF_IFD_POINTER
is legal. This condition will be satisfied if and only if either getTagSet() != null
or isDataTypeOK(TIFF_IFD_POINTER) == true
. Many TIFF extensions use the IFD mechanism in order to limit the number of new tags that may appear in the root IFD.
- Returns:
-
true
if this tag points to an IFD.
hasValueNames
public boolean hasValueNames()
true
if there are mnemonic names associated with the set of legal values for the data associated with this tag. Mnemonic names apply only to tags which have integral data type.- Returns:
-
true
if mnemonic value names are available.
addValueName
protected void addValueName(int value, String name)
- Parameters:
-
value
- the data value. -
name
- the name to associate with the value.
getValueName
public String getValueName(int value)
null
if no name is present. Mnemonic names apply only to tags which have integral data type.- Parameters:
-
value
- the data value. - Returns:
- the mnemonic name associated with the value, as a
String
.
getNamedValues
public int[] getNamedValues()
getValueName()
will return non-null
only for values contained in the returned array. Mnemonic names apply only to tags which have integral data type.- Returns:
- the values for which there is a mnemonic name.
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/imageio/plugins/tiff/TIFFTag.html