edu.harvard.hul.ois.jhove.module.tiff
Class TagFamily

java.lang.Object
  |
  +--edu.harvard.hul.ois.jhove.module.tiff.TagFamily
Direct Known Subclasses:
CoreTags, EPTags, ExifIFDTags, ExifTags, FTags, GeoTiffTags, GPSIFDTags, InterOpIFDTags, ITTags

public abstract class TagFamily
extends java.lang.Object

Subclasses of this abstract class encapsulate a set of TIFF tags, providing accessor functions for their values. Any TiffIFD instance should instantiate all the subclasses of TagFamily, enabling those which are actually legitimate for the IFD by setting the enabled parameter in the constructor.


Field Summary
protected  boolean _enabled
          True if tag family enabled.
protected  TiffIFD _ifd
          TIFF IFD.
protected  int _version
          TIFF version.
static int UNDEFINED
          Undefined initial value.
 
Constructor Summary
TagFamily(TiffIFD ifd, boolean enabled)
          TagFamily constructor.
 
Method Summary
protected  void checkCount(int tag, int nValues, int minCount)
          Check the tag entry count.
protected  void checkType(int tag, int fieldType, int type)
          Check the tag entry type.
protected  void checkType(int tag, int fieldType, int type1, int type2)
          Check the tag entry type.
 boolean isEnabled()
          Returns true if this TagFamily object is enabled.
protected abstract  boolean lookupTag(TiffModule module, TiffIFD ifd, int tag, int fieldType, int nValues, long valueOffset, RepInfo info)
          Looks up a tag in a TagFamily object.
protected  java.lang.String makeAscii(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a string value from a tag whose type is ASCII or UNDEFINED.
protected  java.lang.String[] makeAsciiArray(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a string array from a tag whose type is ASCII or UNDEFINED.
protected  double[] makeDoubleArray(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a double array value from a tag whose type is DOUBLE.
protected  int makeInt(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains an integer value from a tag whose type is integer-compatible.
protected  int[] makeIntArray(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains an integer array value from a tag whose type is integer-compatible.
protected  long makeLong(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a long value from a tag whose type is integer-compatible.
protected  long[] makeLongArray(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a long array value from a tag whose type is integer-compatible.
protected  Rational makeRational(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a Rational value from a tag whose type is RATIONAL.
protected  Rational[] makeRationalArray(TiffModule module, TiffTag tiffTag, long valueOffset)
          Obtains a Rational array value from a tag whose type is Rational.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Undefined initial value.

See Also:
Constant Field Values

_enabled

protected boolean _enabled
True if tag family enabled.


_ifd

protected TiffIFD _ifd
TIFF IFD.


_version

protected int _version
TIFF version.

Constructor Detail

TagFamily

public TagFamily(TiffIFD ifd,
                 boolean enabled)
TagFamily constructor. Subclasses of TagFamily should call this as a superclass constructor.

Parameters:
ifd - The IFD from which the tag came
enabled - true if we should make use of this TagFamily subclass for the current IFD
Method Detail

checkCount

protected void checkCount(int tag,
                          int nValues,
                          int minCount)
                   throws TiffException
Check the tag entry count.

Parameters:
tag - Tag entry value
nValues - Tag entry count
minCount - Tag count
TiffException

checkType

protected void checkType(int tag,
                         int fieldType,
                         int type)
                  throws TiffException
Check the tag entry type.

Parameters:
tag - Tag entry value
fieldType - Tag entry type
type - Tag type
TiffException

checkType

protected void checkType(int tag,
                         int fieldType,
                         int type1,
                         int type2)
                  throws TiffException
Check the tag entry type.

Parameters:
tag - Tag entry value
fieldType - Tag entry type
type1 - Tag type
type2 - Alternate tag type
TiffException

isEnabled

public boolean isEnabled()
Returns true if this TagFamily object is enabled.


lookupTag

protected abstract boolean lookupTag(TiffModule module,
                                     TiffIFD ifd,
                                     int tag,
                                     int fieldType,
                                     int nValues,
                                     long valueOffset,
                                     RepInfo info)
                              throws TiffException
Looks up a tag in a TagFamily object. Sets instance variables as necessary to record the tag, and may change the contents of the info parameter. If a TagFamily object is not enabled, its lookupTag method must not be called.

Parameters:
module - The TiffModule under which the tag is being read
ifd - The TiffIFD in which the tag was found
tag - The tag value for the tag being looked up
fieldType - The field type (using the TIFF type values)
nValues - The number of values indicated by the tag
valueOffset - The offset in the file to the value. If the size of the data is 4 or less, this will be an offset to the "offset" field itself.
info - The RepInfo object describing the current file
TiffException

makeAscii

protected java.lang.String makeAscii(TiffModule module,
                                     TiffTag tiffTag,
                                     long valueOffset)
                              throws java.io.IOException
Obtains a string value from a tag whose type is ASCII or UNDEFINED. This should be used only with tags which are expected to have a single string; if it has more than one string (separated by nulls), only the first will be returned.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value. If the value is contained in the tag, this must be the offset to the datum in the tag itself.
java.io.IOException

makeAsciiArray

protected java.lang.String[] makeAsciiArray(TiffModule module,
                                            TiffTag tiffTag,
                                            long valueOffset)
                                     throws java.io.IOException
Obtains a string array from a tag whose type is ASCII or UNDEFINED. This should be used with tags which may contain multiple, null-separated strings.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value. If the value is contained in the tag, this must be the offset to the datum in the tag itself.
java.io.IOException

makeDoubleArray

protected double[] makeDoubleArray(TiffModule module,
                                   TiffTag tiffTag,
                                   long valueOffset)
                            throws java.io.IOException
Obtains a double array value from a tag whose type is DOUBLE. This should be used with tags which may have multiple values.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value.
java.io.IOException

makeInt

protected int makeInt(TiffModule module,
                      TiffTag tiffTag,
                      long valueOffset)
               throws java.io.IOException
Obtains an integer value from a tag whose type is integer-compatible. This should be used only with tags which are expected to have a single value; if it has more than one value, only the first will be returned.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value. If the value is contained in the tag, this must be the offset to the datum in the tag itself.
java.io.IOException

makeIntArray

protected int[] makeIntArray(TiffModule module,
                             TiffTag tiffTag,
                             long valueOffset)
                      throws java.io.IOException
Obtains an integer array value from a tag whose type is integer-compatible. This should be used with tags which may have multiple values.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value.
java.io.IOException

makeLong

protected long makeLong(TiffModule module,
                        TiffTag tiffTag,
                        long valueOffset)
                 throws java.io.IOException
Obtains a long value from a tag whose type is integer-compatible. This should be used only with tags which are expected to have a single value; if it has more than one value, only the first will be returned.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value. If the value is contained in the tag, this must be the offset to the datum in the tag itself.
java.io.IOException

makeLongArray

protected long[] makeLongArray(TiffModule module,
                               TiffTag tiffTag,
                               long valueOffset)
                        throws java.io.IOException
Obtains a long array value from a tag whose type is integer-compatible. This should be used with tags which may have multiple values.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value.
java.io.IOException

makeRational

protected Rational makeRational(TiffModule module,
                                TiffTag tiffTag,
                                long valueOffset)
                         throws java.io.IOException
Obtains a Rational value from a tag whose type is RATIONAL. This should be used only with tags which are expected to have a single value; if it has more than one value, only the first will be returned.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value. If the value is contained in the tag, this must be the offset to the datum in the tag itself.
java.io.IOException

makeRationalArray

protected Rational[] makeRationalArray(TiffModule module,
                                       TiffTag tiffTag,
                                       long valueOffset)
                                throws java.io.IOException
Obtains a Rational array value from a tag whose type is Rational. This should be used with tags which may have multiple values.

Parameters:
module - The TiffModule under which we are operating
tiffTag - The TiffTag from which we are extracting the value
valueOffset - The offset to the data value.
java.io.IOException