| java.lang.Object com.sun.media.jai.codec.TIFFField
TIFFField | public class TIFFField extends Object implements Comparable,Serializable(Code) | | A class representing a field in a TIFF 6.0 Image File Directory.
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.
See Also: javax.media.jai.operator.TIFFDescriptor See Also: TIFFDirectory |
Field Summary | |
final public static int | TIFF_ASCII Flag for null-terminated ASCII strings. | final public static int | TIFF_BYTE Flag for 8 bit unsigned integers. | final public static int | TIFF_DOUBLE Flag for 64 bit IEEE doubles. | final public static int | TIFF_FLOAT Flag for 32 bit IEEE floats. | final public static int | TIFF_LONG Flag for 32 bit unsigned integers. | final public static int | TIFF_RATIONAL Flag for pairs of 32 bit unsigned integers. | final public static int | TIFF_SBYTE Flag for 8 bit signed integers. | final public static int | TIFF_SHORT Flag for 16 bit unsigned integers. | final public static int | TIFF_SLONG Flag for 32 bit signed integers. | final public static int | TIFF_SRATIONAL Flag for pairs of 32 bit signed integers. | final public static int | TIFF_SSHORT Flag for 16 bit signed integers. | final public static int | TIFF_UNDEFINED Flag for 8 bit uninterpreted bytes. | int | count The number of data items present in the field. | Object | data The field data. | int | tag The tag number. | int | type The tag type. |
Constructor Summary | |
| TIFFField() The default constructor. | public | TIFFField(int tag, int type, int count, Object data) Constructs a TIFFField with arbitrary data. |
Method Summary | |
public int | compareTo(Object o) Compares this TIFFField with another
TIFFField by comparing the tags. | public byte[] | getAsBytes() Returns the data as an uninterpreted array of bytes. | public char[] | getAsChars() Returns TIFF_SHORT data as an array of chars (unsigned 16-bit
integers). | public double | getAsDouble(int index) Returns data in any numerical format as a float. | public double[] | getAsDoubles() Returns TIFF_DOUBLE data as an array of doubles. | public float | getAsFloat(int index) Returns data in any numerical format as a float. | public float[] | getAsFloats() Returns TIFF_FLOAT data as an array of floats. | public int | getAsInt(int index) Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
TIFF_SSHORT, or TIFF_SLONG format as an int.
TIFF_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]. | public int[] | getAsInts() Returns TIFF_SLONG data as an array of ints (signed 32-bit
integers). | public long | getAsLong(int index) Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG format as a long.
TIFF_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]. | public long[] | getAsLongs() Returns TIFF_LONG data as an array of longs (signed 64-bit
integers). | public long[] | getAsRational(int index) Returns a TIFF_RATIONAL data item as a two-element array
of ints. | public long[][] | getAsRationals() Returns TIFF_RATIONAL data as an array of 2-element arrays of longs. | public int[] | getAsSRational(int index) Returns a TIFF_SRATIONAL data item as a two-element array
of ints. | public int[][] | getAsSRationals() Returns TIFF_SRATIONAL data as an array of 2-element arrays of ints. | public short[] | getAsShorts() Returns TIFF_SSHORT data as an array of shorts (signed 16-bit
integers). | public String | getAsString(int index) Returns a TIFF_ASCII data item as a String. | public int | getCount() Returns the number of data items present in the field. | public int | getTag() Returns the tag number, between 0 and 65535. | public int | getType() Returns the type of the data stored in the field.
For a TIFF6.0 file, the value will equal one of the
TIFF_ constants defined in this class. |
TIFF_ASCII | final public static int TIFF_ASCII(Code) | | Flag for null-terminated ASCII strings.
|
TIFF_BYTE | final public static int TIFF_BYTE(Code) | | Flag for 8 bit unsigned integers.
|
TIFF_DOUBLE | final public static int TIFF_DOUBLE(Code) | | Flag for 64 bit IEEE doubles.
|
TIFF_FLOAT | final public static int TIFF_FLOAT(Code) | | Flag for 32 bit IEEE floats.
|
TIFF_LONG | final public static int TIFF_LONG(Code) | | Flag for 32 bit unsigned integers.
|
TIFF_RATIONAL | final public static int TIFF_RATIONAL(Code) | | Flag for pairs of 32 bit unsigned integers.
|
TIFF_SBYTE | final public static int TIFF_SBYTE(Code) | | Flag for 8 bit signed integers.
|
TIFF_SHORT | final public static int TIFF_SHORT(Code) | | Flag for 16 bit unsigned integers.
|
TIFF_SLONG | final public static int TIFF_SLONG(Code) | | Flag for 32 bit signed integers.
|
TIFF_SRATIONAL | final public static int TIFF_SRATIONAL(Code) | | Flag for pairs of 32 bit signed integers.
|
TIFF_SSHORT | final public static int TIFF_SSHORT(Code) | | Flag for 16 bit signed integers.
|
TIFF_UNDEFINED | final public static int TIFF_UNDEFINED(Code) | | Flag for 8 bit uninterpreted bytes.
|
count | int count(Code) | | The number of data items present in the field.
|
tag | int tag(Code) | | The tag number.
|
type | int type(Code) | | The tag type.
|
TIFFField | TIFFField()(Code) | | The default constructor.
|
TIFFField | public TIFFField(int tag, int type, int count, Object data)(Code) | | Constructs a TIFFField with arbitrary data. The data
parameter must be an array of a Java type appropriate for the
type of the TIFF field. Since there is no available 32-bit
unsigned datatype, long is used. The mapping between types is
as follows:
TIFF type | Java type |
TIFF_BYTE | byte |
TIFF_ASCII | String |
TIFF_SHORT | char |
TIFF_LONG | long |
TIFF_RATIONAL | long[2] |
TIFF_SBYTE | byte |
TIFF_UNDEFINED | byte |
TIFF_SSHORT | short |
TIFF_SLONG | int |
TIFF_SRATIONAL | int[2] |
TIFF_FLOAT | float |
TIFF_DOUBLE | double |
Note that the data parameter should always
be the actual field value regardless of the number of bytes
required for that value. This is the case despite the fact
that the TIFF IFD Entry corresponding to the field may
actually contain the offset to the field's value rather than
the value itself (the latter occurring if and only if the
value fits into 4 bytes).
|
compareTo | public int compareTo(Object o)(Code) | | Compares this TIFFField with another
TIFFField by comparing the tags.
Note: this class has a natural ordering that is inconsistent
with equals() .
throws: IllegalArgumentException - if the parameter is null . throws: ClassCastException - if the parameter is not aTIFFField . |
getAsBytes | public byte[] getAsBytes()(Code) | | Returns the data as an uninterpreted array of bytes.
The type of the field must be one of TIFF_BYTE, TIFF_SBYTE,
or TIFF_UNDEFINED;
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.
|
getAsChars | public char[] getAsChars()(Code) | | Returns TIFF_SHORT data as an array of chars (unsigned 16-bit
integers).
A ClassCastException will be thrown if the field is not
of type TIFF_SHORT.
|
getAsDouble | public double getAsDouble(int index)(Code) | | Returns data in any numerical format as a float. Data in
TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
dividing the numerator into the denominator using
double-precision arithmetic.
A ClassCastException will be thrown if the field is of
type TIFF_UNDEFINED or TIFF_ASCII.
|
getAsDoubles | public double[] getAsDoubles()(Code) | | Returns TIFF_DOUBLE data as an array of doubles.
A ClassCastException will be thrown if the field is not
of type TIFF_DOUBLE.
|
getAsFloat | public float getAsFloat(int index)(Code) | | Returns data in any numerical format as a float. Data in
TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
dividing the numerator into the denominator using
double-precision arithmetic and then truncating to single
precision. Data in TIFF_SLONG, TIFF_LONG, or TIFF_DOUBLE
format may suffer from truncation.
A ClassCastException will be thrown if the field is
of type TIFF_UNDEFINED or TIFF_ASCII.
|
getAsFloats | public float[] getAsFloats()(Code) | | Returns TIFF_FLOAT data as an array of floats.
A ClassCastException will be thrown if the field is not
of type TIFF_FLOAT.
|
getAsInt | public int getAsInt(int index)(Code) | | Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
TIFF_SSHORT, or TIFF_SLONG format as an int.
TIFF_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.
|
getAsInts | public int[] getAsInts()(Code) | | Returns TIFF_SLONG data as an array of ints (signed 32-bit
integers).
A ClassCastException will be thrown if the field is not
of type TIFF_SLONG.
|
getAsLong | public long getAsLong(int index)(Code) | | Returns data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT,
TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG format as a long.
TIFF_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.
|
getAsLongs | public long[] getAsLongs()(Code) | | Returns TIFF_LONG data as an array of longs (signed 64-bit
integers).
A ClassCastException will be thrown if the field is not
of type TIFF_LONG.
|
getAsRational | public long[] getAsRational(int index)(Code) | | Returns a TIFF_RATIONAL data item as a two-element array
of ints.
A ClassCastException will be thrown if the field is not
of type TIFF_RATIONAL.
|
getAsRationals | public long[][] getAsRationals()(Code) | | Returns TIFF_RATIONAL data as an array of 2-element arrays of longs.
A ClassCastException will be thrown if the field is not
of type TIFF_RATTIONAL.
|
getAsSRational | public int[] getAsSRational(int index)(Code) | | Returns a TIFF_SRATIONAL data item as a two-element array
of ints.
A ClassCastException will be thrown if the field is not
of type TIFF_SRATIONAL.
|
getAsSRationals | public int[][] getAsSRationals()(Code) | | Returns TIFF_SRATIONAL data as an array of 2-element arrays of ints.
A ClassCastException will be thrown if the field is not
of type TIFF_SRATIONAL.
|
getAsShorts | public short[] getAsShorts()(Code) | | Returns TIFF_SSHORT data as an array of shorts (signed 16-bit
integers).
A ClassCastException will be thrown if the field is not
of type TIFF_SSHORT.
|
getAsString | public String getAsString(int index)(Code) | | Returns a TIFF_ASCII data item as a String.
A ClassCastException will be thrown if the field is not
of type TIFF_ASCII.
|
getCount | public int getCount()(Code) | | Returns the number of data items present in the field.
|
getTag | public int getTag()(Code) | | Returns the tag number, between 0 and 65535.
|
getType | public int getType()(Code) | | Returns the type of the data stored in the field.
For a TIFF6.0 file, the value will equal one of the
TIFF_ constants defined in this class. For future
revisions of TIFF, higher values are possible.
|
|
|