Class TiffField
- java.lang.Object
-
- org.apache.commons.imaging.formats.tiff.TiffField
-
public class TiffField extends java.lang.ObjectA TIFF field in a TIFF directory. Immutable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTiffField.OversizeValueElement
-
Field Summary
Fields Modifier and Type Field Description private AbstractFieldTypeabstractFieldTypeprivate java.nio.ByteOrderbyteOrderprivate longcountprivate intdirectoryTypeprivate static java.util.logging.LoggerLOGGERprivate longoffsetprivate intsortHintprivate inttagprivate TagInfotagInfoprivate byte[]value
-
Constructor Summary
Constructors Constructor Description TiffField(int tag, int directoryType, AbstractFieldType abstractFieldType, long count, long offset, byte[] value, java.nio.ByteOrder byteOrder, int sortHint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddump()voiddump(java.io.PrintWriter pw)voiddump(java.io.PrintWriter pw, java.lang.String prefix)byte[]getByteArrayValue()Returns a copy of the raw value of the field.java.nio.ByteOrdergetByteOrder()Returns the field's byte order.intgetBytesLength()The length of the field's value.longgetCount()Returns the field's count, derived from bytes 4-7.java.lang.StringgetDescriptionWithoutValue()intgetDirectoryType()double[]getDoubleArrayValue()doublegetDoubleValue()AbstractFieldTypegetFieldType()Returns the field's type, derived from bytes 2-3.java.lang.StringgetFieldTypeName()int[]getIntArrayValue()intgetIntValue()intgetIntValueOrArraySum()long[]getLongArrayValue()Gets the value of the field in the form of an array of eight-byte (long) integers.longgetLongValue()Gets the value of the field in the form of an eight-byte (long) integer.intgetOffset()Returns the TIFF field's offset/value field, derived from bytes 8-11.AbstractTiffElementgetOversizeValueElement()intgetSortHint()java.lang.StringgetStringValue()intgetTag()Returns the field's tag, derived from bytes 0-1.TagInfogetTagInfo()java.lang.StringgetTagName()java.lang.ObjectgetValue()java.lang.StringgetValueDescription()private java.lang.StringgetValueDescription(java.lang.Object o)booleanisLocalValue()Indicates whether the field's value is inlined into the offset field.java.lang.StringtoString()
-
-
-
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
-
abstractFieldType
private final AbstractFieldType abstractFieldType
-
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, AbstractFieldType abstractFieldType, long count, long offset, byte[] value, java.nio.ByteOrder byteOrder, int sortHint)
-
-
Method Detail
-
dump
public void dump()
-
dump
public void dump(java.io.PrintWriter pw)
-
dump
public void dump(java.io.PrintWriter pw, java.lang.String prefix)
-
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.
-
getByteOrder
public java.nio.ByteOrder getByteOrder()
Returns the field's byte order.- Returns:
- the byte order
-
getBytesLength
public int getBytesLength()
The length of the field's value.- Returns:
- the length, in bytes.
-
getCount
public long getCount()
Returns the field's count, derived from bytes 4-7.- Returns:
- the count
-
getDescriptionWithoutValue
public java.lang.String getDescriptionWithoutValue()
-
getDirectoryType
public int getDirectoryType()
-
getDoubleArrayValue
public double[] getDoubleArrayValue() throws ImagingException- Throws:
ImagingException
-
getDoubleValue
public double getDoubleValue() throws ImagingException- Throws:
ImagingException
-
getFieldType
public AbstractFieldType getFieldType()
Returns the field's type, derived from bytes 2-3.- Returns:
- the field's type, as a
FieldTypeobject.
-
getFieldTypeName
public java.lang.String getFieldTypeName()
-
getIntArrayValue
public int[] getIntArrayValue() throws ImagingException- Throws:
ImagingException
-
getIntValue
public int getIntValue() throws ImagingException- Throws:
ImagingException
-
getIntValueOrArraySum
public int getIntValueOrArraySum() throws ImagingException- Throws:
ImagingException
-
getLongArrayValue
public long[] getLongArrayValue() throws ImagingExceptionGets the value of the field in the form of an array of eight-byte (long) integers.- Returns:
- an valid array of size zero or larger giving signed long integer values.
- Throws:
ImagingException- if the field instance is of an incompatible type or does not contain a valid data element.
-
getLongValue
public long getLongValue() throws ImagingExceptionGets the value of the field in the form of an eight-byte (long) integer.- Returns:
- a signed long integer value.
- Throws:
ImagingException- if the field instance is of an incompatible type or does not contain a valid data element.
-
getOffset
public int getOffset()
Returns the TIFF field's offset/value field, derived from bytes 8-11.- Returns:
- the field's offset in a
longof 4 packed bytes, or its inlined value <= 4 bytes long encoded in the field's byte order.
-
getOversizeValueElement
public AbstractTiffElement getOversizeValueElement()
-
getSortHint
public int getSortHint()
-
getStringValue
public java.lang.String getStringValue() throws ImagingException- Throws:
ImagingException
-
getTag
public int getTag()
Returns the field's tag, derived from bytes 0-1.- Returns:
- the tag, as an
intin which only the lowest 2 bytes are set
-
getTagInfo
public TagInfo getTagInfo()
-
getTagName
public java.lang.String getTagName()
-
getValue
public java.lang.Object getValue() throws ImagingException- Throws:
ImagingException
-
getValueDescription
public java.lang.String getValueDescription()
-
getValueDescription
private java.lang.String getValueDescription(java.lang.Object o)
-
isLocalValue
public boolean isLocalValue()
Indicates whether the field's value is inlined into the offset field.- Returns:
- true if the value is inlined
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-