public class TIFFTag extends Object
The actual tag values used in the root IFD of a standard ("baseline")
tiff stream are defined in the
class.BaselineTIFFTagSet
BaselineTIFFTagSet
,
TIFFField
,
TIFFTagSet
Modifier and Type | Field and Description |
---|---|
(package private) int |
dataTypes |
static int |
MAX_DATATYPE
The numerically largest constant representing a TIFF data type.
|
static int |
MIN_DATATYPE
The numerically smallest constant representing a TIFF data type.
|
(package private) String |
name |
(package private) int |
number |
private static int[] |
sizeOfType |
(package private) TIFFTagSet |
tagSet |
static int |
TIFF_ASCII
Flag for null-terminated ASCII strings.
|
static int |
TIFF_BYTE
Flag for 8 bit unsigned integers.
|
static int |
TIFF_DOUBLE
Flag for 64 bit IEEE doubles.
|
static int |
TIFF_FLOAT
Flag for 32 bit IEEE floats.
|
static int |
TIFF_IFD_POINTER
Flag for IFD pointer defined in TIFF Tech Note 1 in
TIFF Specification Supplement 1.
|
static int |
TIFF_LONG
Flag for 32 bit unsigned integers.
|
static int |
TIFF_RATIONAL
Flag for pairs of 32 bit unsigned integers.
|
static int |
TIFF_SBYTE
Flag for 8 bit signed integers.
|
static int |
TIFF_SHORT
Flag for 16 bit unsigned integers.
|
static int |
TIFF_SLONG
Flag for 32 bit signed integers.
|
static int |
TIFF_SRATIONAL
Flag for pairs of 32 bit signed integers.
|
static int |
TIFF_SSHORT
Flag for 16 bit signed integers.
|
static int |
TIFF_UNDEFINED
Flag for 8 bit uninterpreted bytes.
|
(package private) Map |
valueNames |
Constructor and Description |
---|
TIFFTag(String name,
int number,
int dataTypes)
Constructs a
TIFFTag with a given name, tag
number, and set of legal data types. |
TIFFTag(String name,
int number,
int dataTypes,
TIFFTagSet tagSet)
Constructs a
TIFFTag with a given name, tag number, set
of legal data types, and TIFFTagSet to which it refers. |
Modifier and Type | Method and Description |
---|---|
protected void |
addValueName(int value,
String name)
Adds a mnemonic name for a particular value that this tag's
data may take on.
|
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 |
getNumber()
Returns the integer used to represent the tag.
|
static int |
getSizeOfType(int dataType)
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(int value)
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(int dataType)
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. |
public static final int TIFF_BYTE
public static final int TIFF_ASCII
public static final int TIFF_SHORT
public static final int TIFF_LONG
public static final int TIFF_RATIONAL
public static final int TIFF_SBYTE
public static final int TIFF_UNDEFINED
public static final int TIFF_SSHORT
public static final int TIFF_SLONG
public static final int TIFF_SRATIONAL
public static final int TIFF_FLOAT
public static final int TIFF_DOUBLE
public static final int TIFF_IFD_POINTER
public static final int MIN_DATATYPE
public static final int MAX_DATATYPE
private static final int[] sizeOfType
int number
String name
int dataTypes
TIFFTagSet tagSet
Map valueNames
public TIFFTag(String name, int number, int dataTypes, TIFFTagSet tagSet)
TIFFTag
with a given name, tag number, set
of legal data types, and TIFFTagSet
to which it refers.
The tagSet
parameter will generally be
non-null
only if this TIFFTag
corresponds
to a pointer to a TIFF IFD. In this case tagSet
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.
If there are mnemonic names to be associated with the legal
data values for the tag,
should be called on the new instance
for each name.addValueName()
See the documentation for
for an explanation of how the set
of data types is to be converted into a bit mask.getDataTypes()
name
- the name of the tag; may be null
.number
- the number used to represent the tag.dataTypes
- a bit mask indicating the set of legal data
types for this tag.tagSet
- the TIFFTagSet
to which this tag
belongs; may be null
.public TIFFTag(String name, int number, int dataTypes)
TIFFTag
with a given name, tag
number, and set of legal data types. The tag will have no
associated TIFFTagSet
.name
- the name of the tag; may be null
.number
- the number used to represent the tag.dataTypes
- a bit mask indicating the set of legal data
types for this tag.TIFFTag(String, int, int, TIFFTagSet)
public static int getSizeOfType(int dataType)
dataType
- the data type to be queried.IllegalArgumentException
- if datatype
is
less than MIN_DATATYPE
or greater than
MAX_DATATYPE
.public String getName()
String
.public int getNumber()
int
.public int getDataTypes()
(1 << TIFFTag.TIFF_SHORT) | (1 << TIFFTag.TIFF_LONG)
int
containing a bitmask encoding the
set of valid data types.public boolean isDataTypeOK(int dataType)
true
if the given data type
may be used for the data associated with this tag.dataType
- the data type to be queried, one of
TIFF_BYTE
, TIFF_SHORT
, etc.boolean
indicating whether the given
data type may be used with this tag.IllegalArgumentException
- if datatype
is
less than MIN_DATATYPE
or greater than
MAX_DATATYPE
.public TIFFTagSet getTagSet()
TIFFTagSet
of which this tag is a part.TIFFTagSet
.public boolean isIFDPointer()
true
if this tag is used to point to an IFD
structure containing additional tags. This condition will be
satisfied if and only if either
getTagSet() != null
or
isDataTypeOK(TIFF_IFD_POINTER) == true
.
Many TIFF extensions use this mechanism in order to limit the number of new tags that may appear in the root IFD.
true
if this tag points to an IFD.public boolean hasValueNames()
true
if there are mnemonic names associated with
the set of legal values for the data associated with this tag.true
if mnemonic value names are available.protected void addValueName(int value, String name)
value
- the data value.name
- the name to associate with the value.public String getValueName(int value)
null
if
no name is present.value
- the data value.String
.Copyright © 2017 Open Microscopy Environment