public class TiffField extends Object implements Comparable, Serializable
The TIFF file format is described in more detail in the comments for the TIFFDescriptor class.
A field in a TIFF Image File Directory (IFD). A field is defined as a sequence of values of identical data type. TIFF 6.0 defines 12 data types, which are mapped internally onto the Java datatypes byte, int, long, float, and double.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
TiffParser
,
Serialized FormModifier and Type | Field and Description |
---|---|
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_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.
|
Constructor and Description |
---|
TiffField(int tag,
int type,
int count,
Object data) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o)
Compares this
TIFFField with another
TIFFField by comparing the tags. |
byte[] |
getAsBytes() |
char[] |
getAsChars() |
double |
getAsDouble(int index) |
double[] |
getAsDoubles() |
float |
getAsFloat(int index) |
float[] |
getAsFloats() |
int |
getAsInt(int index) |
int[] |
getAsInts() |
long |
getAsLong(int index) |
long[] |
getAsLongs() |
long[] |
getAsRational(int index) |
long[][] |
getAsRationals() |
short[] |
getAsShorts() |
int[] |
getAsSRational(int index) |
int[][] |
getAsSRationals() |
String |
getAsString(int index) |
int |
getCount() |
int |
getTag() |
int |
getType() |
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 TiffField(int tag, int type, int count, Object data)
public int getTag()
public int getType()
public int getCount()
public byte[] getAsBytes()
For data in TIFF_BYTE format, the application must take care when promoting the data to longer integral types to avoid sign extension.
A ClassCastException will be thrown if the field is not of type TIFF_BYTE, TIFF_SBYTE, or TIFF_UNDEFINED.
public char[] getAsChars()
A ClassCastException will be thrown if the field is not of type TIFF_SHORT.
public short[] getAsShorts()
A ClassCastException will be thrown if the field is not of type TIFF_SSHORT.
public int[] getAsInts()
A ClassCastException will be thrown if the field is not of type TIFF_SLONG.
public long[] getAsLongs()
A ClassCastException will be thrown if the field is not of type TIFF_LONG
public float[] getAsFloats()
A ClassCastException will be thrown if the field is not of type TIFF_FLOAT.
public double[] getAsDoubles()
A ClassCastException will be thrown if the field is not of type TIFF_DOUBLE.
public int[][] getAsSRationals()
A ClassCastException will be thrown if the field is not of type TIFF_SRATIONAL.
public long[][] getAsRationals()
A ClassCastException will be thrown if the field is not of type TIFF_RATTIONAL.
public int getAsInt(int index)
index
- indexTIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].
A ClassCastException will be thrown if the field is not of type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT, TIFF_SSHORT, or TIFF_SLONG.
public long getAsLong(int index)
index
- indexTIFF_BYTE and TIFF_UNDEFINED data are treated as unsigned; that is, no sign extension will take place and the returned value will be in the range [0, 255]. TIFF_SBYTE data will be returned in the range [-128, 127].
A ClassCastException will be thrown if the field is not of type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG.
public float getAsFloat(int index)
index
- indexA ClassCastException will be thrown if the field is of type TIFF_UNDEFINED or TIFF_ASCII.
public double getAsDouble(int index)
index
- indexA ClassCastException will be thrown if the field is of type TIFF_UNDEFINED or TIFF_ASCII.
public String getAsString(int index)
index
- indexA ClassCastException will be thrown if the field is not of type TIFF_ASCII.
public int[] getAsSRational(int index)
index
- indexA ClassCastException will be thrown if the field is not of type TIFF_SRATIONAL.
public long[] getAsRational(int index)
index
- indexA ClassCastException will be thrown if the field is not of type TIFF_RATIONAL.
public int compareTo(Object o)
TIFFField
with another
TIFFField
by comparing the tags.
Note: this class has a natural ordering that is inconsistent
with equals()
.
compareTo
in interface Comparable
o
- object to compare toIllegalArgumentException
- if the parameter is null
.ClassCastException
- if the parameter is not a
TIFFField
.Revision 4.0.15 / 20220727-0149