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

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.tiff.TiffProfile
Direct Known Subclasses:
TiffFXBase, TiffProfileClassB, TiffProfileClassF, TiffProfileClassG, TiffProfileClassIT, TiffProfileClassP, TiffProfileClassR, TiffProfileClassY, TiffProfileDLF, TiffProfileDNG, TiffProfileDNGThumb, TiffProfileEP, TiffProfileExif, TiffProfileExifIFD, TiffProfileExifThumb, TiffProfileGeoTIFF, TiffProfilePagemaker6, TiffProfilePhotoshop, TiffProfileRFC1314

public abstract class TiffProfile
extends java.lang.Object

Abstract class for TIFF profile checkers. A profile applies to a given IFD; the caller should run all profiles on all IFD's and accumulate a List of the Strings returned by getText when satisfiesProfile returns true.


Field Summary
protected  int _mimeClass
           
protected  java.lang.String _profileText
          PRIVATE CLASS FIELDS.
static int MIME_1314
          Values for mimeClass.
static int MIME_FX
          Values for mimeClass.
static int MIME_GENERIC
          Values for mimeClass.
 
Constructor Summary
TiffProfile()
          Creates a TiffProfile.
 
Method Summary
 int getMimeClass()
          Returns the MIME class for this profile.
 java.lang.String getText()
          Returns the text which describes this profile.
 boolean isAlreadyOK()
          Returns the value of the alreadyOK flag.
protected  boolean satisfiesBackgroundColorIndicator(TiffIFD ifd, int value)
          Checks if the value of the BackgroundColorIndicator tag matches the value passed to it.
protected  boolean satisfiesBackgroundColorIndicator(TiffIFD ifd, int[] values)
          Checks if the value of the BackgroundColorIndicator tag matches any of the values in the array passed to it.
protected  boolean satisfiesCompression(TiffIFD ifd, int value)
          Checks if the value of the PlanarConfiguration tag matches the value passed to it.
protected  boolean satisfiesCompression(TiffIFD ifd, int[] values)
          Checks if the value of the Compression tag matches any of the values in the array passed to it.
protected  boolean satisfiesDotRange(TiffIFD ifd, int minValue, int maxValue)
          Checks the DotRange against a minimum and a maximum value.
protected  boolean satisfiesFillOrder(TiffIFD ifd, int[] values)
          Checks if the value of the Indexed tag matches any of the values in the array passed to it.
protected  boolean satisfiesImageColorIndicator(TiffIFD ifd, int value)
          Checks if the value of the ImageColorIndicator tag matches the value passed to it.
protected  boolean satisfiesImageColorIndicator(TiffIFD ifd, int[] values)
          Checks if the value of the ImageColorIndicator tag matches any of the values in the array passed to it.
protected  boolean satisfiesImageWidth(TiffIFD ifd, int[] values)
          Checks if the value of the ImageWidth tag matches any of the values in the array passed to it.
protected  boolean satisfiesIndexed(TiffIFD ifd, int[] values)
          Checks if the value of the Indexed tag matches any of the values in the array passed to it.
protected  boolean satisfiesNewSubfileType(TiffIFD ifd, long value)
          Checks if the value of the NewSubfileType tag matches the value passed to it.
protected  boolean satisfiesNewSubfileType(TiffIFD ifd, long[] values)
          Checks if the value of the NewSubfileType tag matches any of the values in the array passed to it.
protected  boolean satisfiesOrientation(TiffIFD ifd, int value)
          Checks if the value of the Orientation tag matches the value passed to it.
protected  boolean satisfiesOrientation(TiffIFD ifd, int[] values)
          Checks if the value of the Orientation tag matches any of the values in the array passed to it.
protected  boolean satisfiesPhotometricInterpretation(TiffIFD ifd, int value)
          Checks if the value of the PhotometricInterpretation tag matches the value passed to it.
protected  boolean satisfiesPhotometricInterpretation(TiffIFD ifd, int[] values)
          Checks if the value of the PhotometricInterpretation tag matches any of the values in the array passed to it.
protected  boolean satisfiesPlanarConfiguration(TiffIFD ifd, int value)
          Checks if the value of the PlanarConfiguration tag matches the value passed to it.
protected  boolean satisfiesPlanarConfiguration(TiffIFD ifd, int[] values)
          Checks if the value of the PlanarConfiguration tag matches any of the values in the array passed to it.
 boolean satisfiesProfile(IFD ifd)
          Returns true if the IFD satisfies the profile.
protected  boolean satisfiesResolutionUnit(TiffIFD ifd, int value)
          Checks if the value of the ResolutionUnit tag matches the value passed to it.
protected  boolean satisfiesResolutionUnit(TiffIFD ifd, int[] values)
          Checks if the value of the ResolutionUnit tag matches any of the values in the array passed to it.
protected  boolean satisfiesSamplesPerPixel(TiffIFD ifd, int value)
          Checks if the value of the SamplesPerPixel tag matches the value passed to it.
protected  boolean satisfiesSamplesPerPixel(TiffIFD ifd, int[] values)
          Checks if the value of the SamplesPerPixel tag matches any of the values in the array passed to it.
abstract  boolean satisfiesThisProfile(IFD ifd)
          Returns true if the IFD satisfies the profile.
protected  boolean satisfiesXResolution(TiffIFD ifd, int[] values)
          Checks if the value of the XResolution tag matches any of the values in the array passed to it.
protected  boolean satisfiesYResolution(TiffIFD ifd, int[] values)
          Checks if the value of the XResolution tag matches any of the values in the array passed to it.
 void setAlreadyOK(boolean ok)
          Sets the value of the alreadyOK flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_profileText

protected java.lang.String _profileText
PRIVATE CLASS FIELDS.


_mimeClass

protected int _mimeClass

MIME_GENERIC

public static final int MIME_GENERIC
Values for mimeClass. These are the appropriate indices into TiffModule.MIMETYPE

See Also:
Constant Field Values

MIME_FX

public static final int MIME_FX
Values for mimeClass. These are the appropriate indices into TiffModule.MIMETYPE

See Also:
Constant Field Values

MIME_1314

public static final int MIME_1314
Values for mimeClass. These are the appropriate indices into TiffModule.MIMETYPE

See Also:
Constant Field Values
Constructor Detail

TiffProfile

public TiffProfile()
Creates a TiffProfile. Subclass constructors should assign a value to _profileText, then call the super constructor. Sets _mimeClass to MIME_GENERIC. Profiles which indicate other MIME classes should assign a different value to _mimeClass, which is the index into TiffModule.MIMETYPE that should be used.

Method Detail

satisfiesProfile

public final boolean satisfiesProfile(IFD ifd)
Returns true if the IFD satisfies the profile. This calls satisfiesThisProfile(), which does the actual work. satisfiesProfile() sets the alreadyOK flag, which may be checked by calling isAlreadyOK() to save the effort of testing the same profile more than once and thus generating duplicate output. Subclasses should not override satisfiesProfile.

Parameters:
ifd - The IFD which is being evaluated against the profile

satisfiesThisProfile

public abstract boolean satisfiesThisProfile(IFD ifd)
Returns true if the IFD satisfies the profile. Subclasses should override satisfiesThisProfile(), not satisfiesProfile(), as satisfiesProfile() does some additional bookkeeping for all subclases.


getText

public java.lang.String getText()
Returns the text which describes this profile.


setAlreadyOK

public void setAlreadyOK(boolean ok)
Sets the value of the alreadyOK flag.


getMimeClass

public int getMimeClass()
Returns the MIME class for this profile. This will be one of the values MIME_GENERIC, MIME_FX, and MIME_1314, corresponding to indices into TiffModule.MIMETYPE. All profiles which don't imply a special MIME type other than image/tiff should take no special action, allowing MIME_GENERIC to be returned. Classes which return a different value should assign that value to MIME_CLASS in the constructor rather than overriding this.


isAlreadyOK

public boolean isAlreadyOK()
Returns the value of the alreadyOK flag. This flag can be used when a profile is being checked against more than one IFD, to see if it has satisfied a previous IFD and thus avoid duplicate profile listings. The alreadyOK flag is set whenever satisfiesProfile returns true.


satisfiesCompression

protected boolean satisfiesCompression(TiffIFD ifd,
                                       int[] values)
Checks if the value of the Compression tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesCompression

protected boolean satisfiesCompression(TiffIFD ifd,
                                       int value)
Checks if the value of the PlanarConfiguration tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesPhotometricInterpretation

protected boolean satisfiesPhotometricInterpretation(TiffIFD ifd,
                                                     int[] values)
Checks if the value of the PhotometricInterpretation tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesPhotometricInterpretation

protected boolean satisfiesPhotometricInterpretation(TiffIFD ifd,
                                                     int value)
Checks if the value of the PhotometricInterpretation tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesResolutionUnit

protected boolean satisfiesResolutionUnit(TiffIFD ifd,
                                          int[] values)
Checks if the value of the ResolutionUnit tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesResolutionUnit

protected boolean satisfiesResolutionUnit(TiffIFD ifd,
                                          int value)
Checks if the value of the ResolutionUnit tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesXResolution

protected boolean satisfiesXResolution(TiffIFD ifd,
                                       int[] values)
Checks if the value of the XResolution tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesYResolution

protected boolean satisfiesYResolution(TiffIFD ifd,
                                       int[] values)
Checks if the value of the XResolution tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesSamplesPerPixel

protected boolean satisfiesSamplesPerPixel(TiffIFD ifd,
                                           int[] values)
Checks if the value of the SamplesPerPixel tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesSamplesPerPixel

protected boolean satisfiesSamplesPerPixel(TiffIFD ifd,
                                           int value)
Checks if the value of the SamplesPerPixel tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesPlanarConfiguration

protected boolean satisfiesPlanarConfiguration(TiffIFD ifd,
                                               int[] values)
Checks if the value of the PlanarConfiguration tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesPlanarConfiguration

protected boolean satisfiesPlanarConfiguration(TiffIFD ifd,
                                               int value)
Checks if the value of the PlanarConfiguration tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesOrientation

protected boolean satisfiesOrientation(TiffIFD ifd,
                                       int[] values)
Checks if the value of the Orientation tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesOrientation

protected boolean satisfiesOrientation(TiffIFD ifd,
                                       int value)
Checks if the value of the Orientation tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesImageColorIndicator

protected boolean satisfiesImageColorIndicator(TiffIFD ifd,
                                               int[] values)
Checks if the value of the ImageColorIndicator tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesImageColorIndicator

protected boolean satisfiesImageColorIndicator(TiffIFD ifd,
                                               int value)
Checks if the value of the ImageColorIndicator tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesNewSubfileType

protected boolean satisfiesNewSubfileType(TiffIFD ifd,
                                          long[] values)
Checks if the value of the NewSubfileType tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of long values, any of which will satisfy the test.

satisfiesNewSubfileType

protected boolean satisfiesNewSubfileType(TiffIFD ifd,
                                          long value)
Checks if the value of the NewSubfileType tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesBackgroundColorIndicator

protected boolean satisfiesBackgroundColorIndicator(TiffIFD ifd,
                                                    int[] values)
Checks if the value of the BackgroundColorIndicator tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesBackgroundColorIndicator

protected boolean satisfiesBackgroundColorIndicator(TiffIFD ifd,
                                                    int value)
Checks if the value of the BackgroundColorIndicator tag matches the value passed to it.

Parameters:
ifd - The IFD being checked
value - A value which must match the tag value to satisfy the test.

satisfiesDotRange

protected boolean satisfiesDotRange(TiffIFD ifd,
                                    int minValue,
                                    int maxValue)
Checks the DotRange against a minimum and a maximum value. Returns true if the DotRange exists, is well-formed (i.e., has at least 2 values, and the first two values equal minValue and maxValue respectively.


satisfiesImageWidth

protected boolean satisfiesImageWidth(TiffIFD ifd,
                                      int[] values)
Checks if the value of the ImageWidth tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesIndexed

protected boolean satisfiesIndexed(TiffIFD ifd,
                                   int[] values)
Checks if the value of the Indexed tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.

satisfiesFillOrder

protected boolean satisfiesFillOrder(TiffIFD ifd,
                                     int[] values)
Checks if the value of the Indexed tag matches any of the values in the array passed to it.

Parameters:
ifd - The IFD being checked
values - An array of values, any of which will satisfy the test.