|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.harvard.hul.ois.jhove.module.tiff.IFD
public abstract class IFD
Encapsulation of a TIFF image file directory (IFD).
Field Summary | |
---|---|
protected boolean |
_bigEndian
True if big-endian file. |
protected RepInfo |
_info
Representation information. |
protected long |
_next
Offset of next IFD. |
protected long |
_offset
IFD offset. |
protected int |
_version
TIFF version. |
static int |
ASCII
TIFF ASCII type. |
static int |
BYTE
TIFF BYTE (unsigned 8-bit) type. |
static int |
DOUBLE
TIFF DOUBLE (64-bit IEEE floating point) type. |
static int |
EXIF
Exif IFD. |
static int |
FLOAT
TIFF FLOAT (32-bit IEEE floating point) type. |
static int |
GLOBALPARAMETERS
Global parameters IFD. |
static int |
GPSINFO
GPSInfo IFD. |
static int |
IFD
TIFF IFD (LONG) type. |
static int |
INTEROPERABILITY
Exif Interoperability IFD. |
static int |
LONG
TIFF LONG (unsigned 32-bit) type. |
static int |
NULL
Undefined value for integer tags. |
static int |
RATIONAL
TIFF RATIONAL (two LONGs) type. |
static int |
SBYTE
TIFF SBYTE (signed 8-bit) type. |
static int |
SHORT
TIFF SHORT (unsigned 16-bit) type. |
static int |
SLONG
TIFF SLONG (signed 32-bit) type. |
static int |
SRATIONAL
TIFF SRATIONAL (two SLONGs) type. |
static int |
SSHORT
TIFF SSHORT (signed 16-bit) type. |
static int |
TIFF
Standard TIFF IFD. |
static java.lang.String[] |
TYPE
TIFF type labels. |
static int |
UNDEFINED
TIFF UNDEFINED (unsigned 8-bit) type. |
Constructor Summary | |
---|---|
IFD(long offset,
RepInfo info,
java.io.RandomAccessFile raf,
boolean bigEndian)
Instantiate an IFD object. |
Method Summary | |
---|---|
protected Property |
addBitmaskProperty(java.lang.String name,
long value,
java.lang.String[] labels,
boolean rawOutput)
Returns a Property representing a bitmask. |
protected Property |
addIntegerArrayProperty(java.lang.String name,
int[] value,
java.lang.String[] labels,
boolean rawOutput)
Returns an ARRAY Property representing an integer array. |
protected Property |
addIntegerProperty(java.lang.String name,
int value,
java.lang.String[] labels,
boolean rawOutput)
Returns an Property representing an integer value. |
protected Property |
addIntegerProperty(java.lang.String name,
int value,
java.lang.String[] labels,
int[] index,
boolean rawOutput)
Returns an Property representing an integer value. |
protected Property |
addRationalArrayProperty(java.lang.String name,
Rational[] r,
boolean rawOutput)
|
protected Property |
addRationalProperty(java.lang.String name,
Rational r,
boolean rawOutput)
Returns a property for a tag with a RATIONAL value. |
protected static Rational |
average(Rational r1,
Rational r2)
|
static long |
calcValueSize(int type,
long count)
Calculate how many bytes a given number of fields of a given type will require. |
protected static void |
checkCount(int tag,
long count,
int minCount)
Check the tag entry count. |
protected static void |
checkType(int tag,
int type,
int expected)
Check the tag entry type. |
protected static void |
checkType(int tag,
int type,
int type1,
int type2)
Check the tag entry type. |
java.util.List<java.lang.String> |
getErrors()
Get any errors discovered during parsing. |
long |
getNext()
Get the offset of the next IFD. |
long |
getOffset()
Get the IFD offset. |
abstract Property |
getProperty(boolean rawOutput)
Get the IFD properties. |
int |
getVersion()
Get the TIFF version. |
boolean |
isBigEndian()
Returns true if file is big-endian,
false if little-endian. |
boolean |
isFirst()
Return true if this is the first IFD. |
boolean |
isThumbnail()
Return true if this is the thumbnail IFD. |
abstract void |
lookupTag(int tag,
int type,
long count,
long value)
Lookup IFD tag. |
long |
parse()
Parse the IFD. |
long |
parse(boolean byteOffsetIsValid)
Parse the IFD. |
long |
parse(boolean byteOffsetIsValid,
boolean suppressErrors)
Parse the IFD. |
protected void |
postParseInitialization()
Perform initializations that have to wait until after the IFD has been parsed. |
protected Property |
propertyHeader(java.lang.String type,
java.util.List entries)
Standard IFD property header. |
protected java.lang.String |
readASCII(long count,
long value)
Reads a string value from the TIFF file. |
protected java.lang.String[] |
readASCIIArray(long count,
long value)
Reads an array of strings from the TIFF file. |
protected int |
readByte(int type,
long count,
long value)
Reads and returns a single unsigned 8-bit integer value. |
protected int[] |
readByteArray(int type,
long count,
long value)
Reads an array of bytes and returns it as an int array. |
protected double[] |
readDoubleArray(long count,
long value)
Reads a TIFF array of DOUBLE 64-bit values and returns it as a double array. |
protected long |
readLong(int type,
long count,
long value)
Reads and returns a single unsigned 32-bit integer value. |
protected long[] |
readLongArray(int type,
long count,
long value)
Reads a TIFF array of signed 32-bit integer values and returns it as a long array. |
protected Rational |
readRational(long count,
long value)
Reads a RATIONAL value and returns it as a Rational. |
protected Rational[] |
readRationalArray(long count,
long value)
Reads an array of RATIONAL values and returns it as an array of Rational. |
protected int |
readShort(int type,
long count,
long value)
Reads and returns a single unsigned 16-bit value. |
protected int[] |
readShortArray(int type,
long count,
long value)
Reads a TIFF array of unsigned 16-bit values and returns it as an int array. |
protected Rational |
readSignedRational(long count,
long value)
Reads an SRATIONAL value and returns it as a Rational. |
protected Rational[] |
readSignedRationalArray(long count,
long value)
Reads an array of SRATIONAL values and returns it as an array of Rational. |
protected int[] |
readSShortArray(int type,
long count,
long value)
Reads a TIFF array of signed 16-bit values and returns it as an int array. |
protected byte[] |
readTrueByteArray(int type,
long count,
long value)
Reads an array of bytes and returns it as a byte array. |
long |
readUnsigned(int type)
Reads an unsigned number of any type. |
void |
setFirst(boolean first)
Sets flag indicating whether this is the first IFD. |
void |
setThumbnail(boolean thumbnail)
Sets flag indicating whether this is the "thumbnail" IFD. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TIFF
public static final int EXIF
public static final int INTEROPERABILITY
public static final int GPSINFO
public static final int GLOBALPARAMETERS
public static final int NULL
public static final int BYTE
public static final int ASCII
public static final int SHORT
public static final int LONG
public static final int RATIONAL
public static final int SBYTE
public static final int UNDEFINED
public static final int SSHORT
public static final int SLONG
public static final int SRATIONAL
public static final int FLOAT
public static final int DOUBLE
public static final int IFD
public static final java.lang.String[] TYPE
protected boolean _bigEndian
protected RepInfo _info
protected long _next
protected long _offset
protected int _version
Constructor Detail |
---|
public IFD(long offset, RepInfo info, java.io.RandomAccessFile raf, boolean bigEndian)
IFD
object.
offset
- IFD offsetinfo
- Representation informationraf
- TIFF filebigEndian
- True if big-endian fileMethod Detail |
---|
public java.util.List<java.lang.String> getErrors()
public long getNext()
public long getOffset()
public abstract Property getProperty(boolean rawOutput) throws TiffException
TiffException
public int getVersion()
public boolean isFirst()
public boolean isThumbnail()
public abstract void lookupTag(int tag, int type, long count, long value) throws TiffException
TiffException
public long parse() throws TiffException
TiffException
public long parse(boolean byteOffsetIsValid, boolean suppressErrors) throws TiffException
byteOffsetIsValid
- If true, allow offsets on odd byte boundariessuppressErrors
- If true, return IFD even with errors
TiffException
public long parse(boolean byteOffsetIsValid) throws TiffException
byteOffsetIsValid
- If true, allow offsets on odd byte boundaries
TiffException
public void setFirst(boolean first)
public void setThumbnail(boolean thumbnail)
protected Property addBitmaskProperty(java.lang.String name, long value, java.lang.String[] labels, boolean rawOutput)
rawOutput
is true, returns a LIST
property whose elements are STRING properties. The
string values of these STRING properties are the
elements of labels
whose indices
correspond to 1 bits in the bitmask, counting
the low-order bit as bit 0.
if rawOutput
is false, returns a LONG
property whose numeric value is value
.
protected Property addIntegerProperty(java.lang.String name, int value, java.lang.String[] labels, boolean rawOutput)
rawOutput
is true, returns
an INTEGER property, and labels
and
index
are unused. Otherwise,
returns a STRING property, with the
string being the element of labels
whose index is value
.
protected Property addIntegerProperty(java.lang.String name, int value, java.lang.String[] labels, int[] index, boolean rawOutput)
rawOutput
is true, returns
an INTEGER property, and labels
and
index
are unused. Otherwise,
returns a STRING property, with the
string being the element of labels
whose index is the index of
value
in index
.
protected Property addIntegerArrayProperty(java.lang.String name, int[] value, java.lang.String[] labels, boolean rawOutput)
rawOutput
is true, the elements of the property array
are INTEGER properties, and labels
is unused. Otherwise,
the elements of the array are STRING properties, with the
elements of value
used as indices into
labels
.
protected Property addRationalProperty(java.lang.String name, Rational r, boolean rawOutput)
protected Property addRationalArrayProperty(java.lang.String name, Rational[] r, boolean rawOutput)
protected void postParseInitialization()
protected Property propertyHeader(java.lang.String type, java.util.List entries)
protected java.lang.String readASCII(long count, long value) throws java.io.IOException
count
- Length of stringvalue
- Offset of string
java.io.IOException
protected java.lang.String[] readASCIIArray(long count, long value) throws java.io.IOException
count
- Number of strings to readvalue
- Offset from which to read
java.io.IOException
protected int readByte(int type, long count, long value) throws java.io.IOException
type
- TIFF type to read; must be an 8-bit typecount
- Unusedvalue
- Offset from which to read
java.io.IOException
protected int[] readByteArray(int type, long count, long value) throws java.io.IOException
type
- TIFF type to read; must be an 8-bit typecount
- Number of bytes to readvalue
- Offset from which to read
java.io.IOException
protected byte[] readTrueByteArray(int type, long count, long value) throws java.io.IOException
type
- Unusedcount
- Number of bytes to readvalue
- Offset from which to read
java.io.IOException
protected double[] readDoubleArray(long count, long value) throws java.io.IOException
count
- Number of values to readvalue
- Offset from which to read
java.io.IOException
protected long readLong(int type, long count, long value) throws java.io.IOException
type
- TIFF type to read; must be a 32-bit typecount
- Unusedvalue
- Offset from which to read
java.io.IOException
protected long[] readLongArray(int type, long count, long value) throws java.io.IOException
type
- TIFF type to read; must be a 32-bit typecount
- Number of values to readvalue
- Offset from which to read
java.io.IOException
public long readUnsigned(int type) throws java.io.IOException
type
- TIFF type to read
java.io.IOException
protected Rational readRational(long count, long value) throws java.io.IOException
java.io.IOException
protected Rational[] readRationalArray(long count, long value) throws java.io.IOException
java.io.IOException
protected Rational readSignedRational(long count, long value) throws java.io.IOException
java.io.IOException
protected Rational[] readSignedRationalArray(long count, long value) throws java.io.IOException
java.io.IOException
protected int readShort(int type, long count, long value) throws java.io.IOException
java.io.IOException
protected int[] readShortArray(int type, long count, long value) throws java.io.IOException
java.io.IOException
protected int[] readSShortArray(int type, long count, long value) throws java.io.IOException
java.io.IOException
public static long calcValueSize(int type, long count)
type
- Field typecount
- Field countpublic boolean isBigEndian()
true
if file is big-endian,
false
if little-endian.
protected static void checkCount(int tag, long count, int minCount) throws TiffException
tag
- Tag entry valuecount
- Tag entry countminCount
- Tag count
TiffException
protected static void checkType(int tag, int type, int expected) throws TiffException
tag
- Tag entry valuetype
- Tag entry typeexpected
- Tag type
TiffException
protected static void checkType(int tag, int type, int type1, int type2) throws TiffException
tag
- Tag entry valuetype
- Tag entry typetype1
- Tag typetype2
- Alternate tag type
TiffException
protected static Rational average(Rational r1, Rational r2)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |