Class TiffField
- java.lang.Object
-
- org.apache.commons.imaging.formats.tiff.TiffField
-
public class TiffField extends java.lang.Object
A TIFF field in a TIFF directory. Immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
TiffField.OversizeValueElement
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteOrder
byteOrder
private long
count
private int
directoryType
private FieldType
fieldType
private static java.util.logging.Logger
LOGGER
private long
offset
private int
sortHint
private int
tag
private TagInfo
tagInfo
private byte[]
value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dump()
void
dump(java.io.PrintWriter pw)
void
dump(java.io.PrintWriter pw, java.lang.String prefix)
byte[]
getByteArrayValue()
Returns a copy of the raw value of the field.java.nio.ByteOrder
getByteOrder()
Returns the field's byte order.int
getBytesLength()
The length of the field's value.long
getCount()
Returns the field's count, derived from bytes 4-7.java.lang.String
getDescriptionWithoutValue()
int
getDirectoryType()
double[]
getDoubleArrayValue()
double
getDoubleValue()
FieldType
getFieldType()
Returns the field's type, derived from bytes 2-3.java.lang.String
getFieldTypeName()
int[]
getIntArrayValue()
int
getIntValue()
int
getIntValueOrArraySum()
int
getOffset()
Returns the TIFF field's offset/value field, derived from bytes 8-11.TiffElement
getOversizeValueElement()
int
getSortHint()
java.lang.String
getStringValue()
int
getTag()
Returns the field's tag, derived from bytes 0-1.TagInfo
getTagInfo()
java.lang.String
getTagName()
java.lang.Object
getValue()
java.lang.String
getValueDescription()
private java.lang.String
getValueDescription(java.lang.Object o)
boolean
isLocalValue()
Indicates whether the field's value is inlined into the offset field.java.lang.String
toString()
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
tagInfo
private final TagInfo tagInfo
-
tag
private final int tag
-
directoryType
private final int directoryType
-
fieldType
private final FieldType fieldType
-
count
private final long count
-
offset
private final long offset
-
value
private final byte[] value
-
byteOrder
private final java.nio.ByteOrder byteOrder
-
sortHint
private final int sortHint
-
-
Constructor Detail
-
TiffField
public TiffField(int tag, int directoryType, FieldType fieldType, long count, long offset, byte[] value, java.nio.ByteOrder byteOrder, int sortHint)
-
-
Method Detail
-
getDirectoryType
public int getDirectoryType()
-
getTagInfo
public TagInfo getTagInfo()
-
getTag
public int getTag()
Returns the field's tag, derived from bytes 0-1.- Returns:
- the tag, as an
int
in which only the lowest 2 bytes are set
-
getFieldType
public FieldType getFieldType()
Returns the field's type, derived from bytes 2-3.- Returns:
- the field's type, as a
FieldType
object.
-
getCount
public long getCount()
Returns the field's count, derived from bytes 4-7.- Returns:
- the count
-
getOffset
public int getOffset()
Returns the TIFF field's offset/value field, derived from bytes 8-11.- Returns:
- the field's offset in a
long
of 4 packed bytes, or its inlined value <= 4 bytes long encoded in the field's byte order.
-
getByteOrder
public java.nio.ByteOrder getByteOrder()
Returns the field's byte order.- Returns:
- the byte order
-
getSortHint
public int getSortHint()
-
isLocalValue
public boolean isLocalValue()
Indicates whether the field's value is inlined into the offset field.- Returns:
- true if the value is inlined
-
getBytesLength
public int getBytesLength()
The length of the field's value.- Returns:
- the length, in bytes.
-
getByteArrayValue
public byte[] getByteArrayValue()
Returns a copy of the raw value of the field.- Returns:
- the value of the field, in the byte order of the field.
-
getOversizeValueElement
public TiffElement getOversizeValueElement()
-
getValueDescription
public java.lang.String getValueDescription()
-
getValueDescription
private java.lang.String getValueDescription(java.lang.Object o)
-
dump
public void dump()
-
dump
public void dump(java.io.PrintWriter pw)
-
dump
public void dump(java.io.PrintWriter pw, java.lang.String prefix)
-
getDescriptionWithoutValue
public java.lang.String getDescriptionWithoutValue()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getTagName
public java.lang.String getTagName()
-
getFieldTypeName
public java.lang.String getFieldTypeName()
-
getValue
public java.lang.Object getValue() throws ImageReadException
- Throws:
ImageReadException
-
getStringValue
public java.lang.String getStringValue() throws ImageReadException
- Throws:
ImageReadException
-
getIntArrayValue
public int[] getIntArrayValue() throws ImageReadException
- Throws:
ImageReadException
-
getDoubleArrayValue
public double[] getDoubleArrayValue() throws ImageReadException
- Throws:
ImageReadException
-
getIntValueOrArraySum
public int getIntValueOrArraySum() throws ImageReadException
- Throws:
ImageReadException
-
getIntValue
public int getIntValue() throws ImageReadException
- Throws:
ImageReadException
-
getDoubleValue
public double getDoubleValue() throws ImageReadException
- Throws:
ImageReadException
-
-