Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.harvard.hul.ois.jhove.module
Class JpegModule

    java.lang.Object
      edu.harvard.hul.ois.jhove.ModuleBase
          edu.harvard.hul.ois.jhove.module.JpegModule

All Implemented Interfaces:
  Module

    public class JpegModule

extends ModuleBase

Module for identification and validation of JPEG files. General notes: There is no such thing as a "JPEG file format." There are several commonly used file formats which encapsulate JPEG data and conform to the JPEG stream format. There are also many formats which can encapsulate JPEG data within some larger wrapper; this module does not attempt to recognize them. Only JPEG file formats which are JPEG streams are treated here. A JPEG stream which isn't one of the known file formats will be regarded as well-formed, but not valid. To be valid, a file must conform to one of the following: JFIF, SPIFF, and JPEG/Exif. Other formats may be added in the future. This module uses the JPEG-L method of detecting a marker following a data stream, checking for a 0 high bit rather than an entire 0 byte. So long at no JPEG markers are defined with a value from 0 through 7F, this is valid for all JPEG files. * @author Gary McGath

Field Summary
`protected java.util.List<java.lang.String>` | `_appSegsList`
`protected java.util.List<ArithConditioning>` | `_arithCondTables`
`protected int` | `_capability0`
`protected int` | `_capability1`
`protected Checksummer` | `_ckSummer`
`protected java.util.List<java.lang.String>` | `_commentsList`
`protected java.util.Set` | `_compressSet`
`protected ChecksumInputStream` | `_cstream`
`protected java.io.DataInputStream` | `_dstream`
`protected boolean` | `_exifProfileOK`
`protected Property` | `_exifProp`
`protected java.util.List<boolean[]>` | `_expList`
`protected java.util.List<Property>` | `_imageList`
`protected Property` | `_imageProp`
`protected java.util.List<java.lang.String>` | `_jpegExtsList`
`protected Property` | `_metadata`
`protected NisoImageMetadata` | `_niso`
`protected int` | `_numScans`
`protected int` | `_numSegments`
`protected java.util.List<Property>` | `_primaryImageList`
`protected java.util.List<Property>` | `_propList`
`protected java.util.List<QuantizationTable>` | `_quantTables`
`protected boolean` | `_reportedJFIF`
`protected boolean` | `_reportedSigMatch`
`protected int` | `_restartInterval`
`protected boolean` | `_seenExif`
`protected boolean` | `_seenJFIF`
`protected boolean` | `_seenJPEGL`
`protected boolean` | `_seenSOF`
`protected boolean` | `_seenSPIFF`
`protected SpiffDir` | `_spiffDir`
`protected java.util.List<SRS>` | `_srsList`
`protected Tiling` | `_tiling`
`protected int` | `_units`
`protected int` | `_xDensity`
`protected Property` | `_xmpProp`
`protected int` | `_yDensity`
`protected java.lang.String` | `exifProfileName`
`protected java.lang.String` | `jfifProfileName` PRIVATE INSTANCE FIELDS.
`protected java.lang.String` | `jpeglProfileName`
`protected java.text.NumberFormat` | `minorFmt`
`protected static int[]` | `sigByte`
`protected java.lang.String` | `spiffProfileName`

Fields inherited from class edu.harvard.hul.ois.jhove.ModuleBase
`_app, _bigEndian, _checksumFinished, _countStream, _coverage, _crc32, _date, _defaultParams, _features, _format, _init, _isRandomAccess, _je, _logger, _md5, _mimeType, _name, _nByte, _note, _param, _release, _repInfoNote, _rights, _sha1, _signature, _specification, _validityNote, _vendor, _verbosity, _wellFormedNote`

Fields inherited from interface edu.harvard.hul.ois.jhove.Module
`MAXIMUM_VERBOSITY, MINIMUM_VERBOSITY`

Constructor Summary
`JpegModule()` Instantiate a `JpegModule` object.

Method Summary
`protected Property` | `buildCapProp(RepInfo info)`
`protected Property` | `buildExpandProp(RepInfo info)`
`protected Property` | `buildTilingProp(RepInfo info)`
`void` | `checkSignatures(java.io.File file, java.io.InputStream stream, RepInfo info)` Check if the digital object conforms to this Module's internal signature information.
`protected static boolean` | `equalArray(int[] a, int[] b)`
`protected void` | `extractExifNisoData(NisoImageMetadata exifData)`
`protected void` | `initNiso()` Initializes the constant portions of the niso metadata.
`protected void` | `initParse()` Initializes the state of the module for parsing.
`int` | `parse(java.io.InputStream stream, RepInfo info, int parseIndex)` Parse the content of a purported JPEG stream digital object and store the results in RepInfo.
`protected void` | `readAPP0(RepInfo info)`
`protected void` | `readAPP1(RepInfo info)`
`protected void` | `readAPP8(RepInfo info)`
`protected void` | `readComment(RepInfo info)`
`protected void` | `readDAC(RepInfo info)`
`protected void` | `readDHP(RepInfo info)`
`protected void` | `readDQT(RepInfo info)`
`protected void` | `readDRI(RepInfo info)`
`protected void` | `readDTI(RepInfo info)`
`protected void` | `readDTT(RepInfo info)`
`protected void` | `readEXP(RepInfo info)`
`protected boolean` | `readHeader(RepInfo info)`
`protected void` | `readJPEGExtension(int dbyt, RepInfo info)`
`protected void` | `readSOF(int dbyt, RepInfo info)`
`protected void` | `readSRS(RepInfo info)`
`long` | `readUnsignedInt(java.io.DataInputStream stream)` One-argument version of `readUnsignedInt`.
`int` | `readUnsignedShort(java.io.DataInputStream stream)` One-argument version of `readUnsignedShort`.
`protected void` | `readVer(RepInfo info)`
`protected Property` | `readXMP(byte[] buf)`
`protected void` | `reportAppExt(int dbyt, RepInfo info)`
`protected boolean` | `skipSegment(RepInfo info)`

Methods inherited from class edu.harvard.hul.ois.jhove.ModuleBase
`addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, getApp, getBase, getBufferedDataStream, getCoverage, getCRC32, getDate, getDefaultParams, getFeatures, getFormat, getMimeType, getName, getNByte, getNote, getRelease, getRepInfoNote, getRights, getSignature, getSpecification, getValidityNote, getVendor, getWellFormedNote, hasFeature, init, initFeatures, isBigEndian, isRandomAccess, param, parse, readByteBuf, readDouble, readDouble, readDouble, readFloat, readFloat, readSignedByte, readSignedByte, readSignedByte, readSignedInt, readSignedInt, readSignedInt, readSignedLong, readSignedRational, readSignedRational, readSignedShort, readSignedShort, readSignedShort, readUnsignedByte, readUnsignedByte, readUnsignedByte, readUnsignedInt, readUnsignedInt, readUnsignedInt, readUnsignedRational, readUnsignedRational, readUnsignedRational, readUnsignedShort, readUnsignedShort, readUnsignedShort, resetParams, setApp, setBase, setChecksums, setCRC32, setDefaultParams, setMD5, setNByte, setSHA1, setValidityNote, setVerbosity, show, skipBytes, skipBytes, vectorToPropArray`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jfifProfileName

    protected java.lang.String jfifProfileName

  PRIVATE INSTANCE FIELDS.

### spiffProfileName

    protected java.lang.String spiffProfileName

### exifProfileName

    protected java.lang.String exifProfileName

### jpeglProfileName

    protected java.lang.String jpeglProfileName

### minorFmt

    protected java.text.NumberFormat minorFmt

### _ckSummer

    protected Checksummer _ckSummer

### _cstream

    protected ChecksumInputStream _cstream

### _dstream

    protected java.io.DataInputStream _dstream

### _metadata

    protected Property _metadata

### _imageProp

    protected Property _imageProp

### _exifProp

    protected Property _exifProp

### _xmpProp

    protected Property _xmpProp

### _niso

    protected NisoImageMetadata _niso

### _propList

    protected java.util.List<Property> _propList

### _imageList

    protected java.util.List<Property> _imageList

### _tiling

    protected Tiling _tiling

### _quantTables

    protected java.util.List<QuantizationTable> _quantTables

### _arithCondTables

    protected java.util.List<ArithConditioning> _arithCondTables

### _srsList

    protected java.util.List<SRS> _srsList

### _primaryImageList

    protected java.util.List<Property> _primaryImageList

### _numSegments

    protected int _numSegments

### _numScans

    protected int _numScans

### _restartInterval

    protected int _restartInterval

### _seenJFIF

    protected boolean _seenJFIF

### _seenSPIFF

    protected boolean _seenSPIFF

### _seenJPEGL

    protected boolean _seenJPEGL

### _reportedSigMatch

    protected boolean _reportedSigMatch

### _spiffDir

    protected SpiffDir _spiffDir

### _seenExif

    protected boolean _seenExif

### _exifProfileOK

    protected boolean _exifProfileOK

### _reportedJFIF

    protected boolean _reportedJFIF

### _seenSOF

    protected boolean _seenSOF

### _commentsList

    protected java.util.List<java.lang.String> _commentsList

### _jpegExtsList

    protected java.util.List<java.lang.String> _jpegExtsList

### _appSegsList

    protected java.util.List<java.lang.String> _appSegsList

### _expList

    protected java.util.List<boolean[]> _expList

### _compressSet

    protected java.util.Set _compressSet

### _capability0

    protected int _capability0

### _capability1

    protected int _capability1

### sigByte

    protected static final int[] sigByte

### _units

    protected int _units

### _xDensity

    protected int _xDensity

### _yDensity

    protected int _yDensity

Constructor Detail

### JpegModule

    public JpegModule()

  Instantiate a `JpegModule` object.

Method Detail

### checkSignatures

    public void checkSignatures(java.io.File file,
                                java.io.InputStream stream,
                                RepInfo info)
                         throws java.io.IOException

  Check if the digital object conforms to this Module's internal signature information.

  Specified by:
    `checkSignatures` in interface `Module`
  Overrides:
    `checkSignatures` in class `ModuleBase`
  Parameters:
    `file` - A RandomAccessFile, positioned at its beginning, which is generated from the object to be parsed
    `stream` - An InputStream, positioned at its beginning, which is generated from the object to be parsed
    `info` - A fresh RepInfo object which will be modified to reflect the results of the test
  Throws:
    `java.io.IOException`

### parse

    public int parse(java.io.InputStream stream,
                     RepInfo info,
                     int parseIndex)
              throws java.io.IOException

  Parse the content of a purported JPEG stream digital object and store the results in RepInfo. This function uses the JPEG-L method of detecting a marker following a data stream, checking for a 0 high bit rather than an entire 0 byte. So long at no JPEG markers are defined with a value from 0 through 7F, this is valid for all JPEG files.

  Specified by:
    `parse` in interface `Module`
  Overrides:
    `parse` in class `ModuleBase`
  Parameters:
    `stream` - An InputStream, positioned at its beginning, which is generated from the object to be parsed
    `info` - A fresh RepInfo object which will be modified to reflect the results of the parsing
    `parseIndex` - Must be 0 in first call to `parse`. If `parse` returns a nonzero value, it must be called again with `parseIndex` equal to that return value.
  Throws:
    `java.io.IOException`

### readUnsignedShort

    public int readUnsignedShort(java.io.DataInputStream stream)
                          throws java.io.IOException

  One-argument version of `readUnsignedShort`. JPEG is always big-endian, so readUnsignedShort can unambiguously drop its endian argument.

  Throws:
    `java.io.IOException`

### readUnsignedInt

    public long readUnsignedInt(java.io.DataInputStream stream)
                         throws java.io.IOException

  One-argument version of `readUnsignedInt`. JPEG is always big-endian, so readUnsignedInt can unambiguously drop its endian argument.

  Throws:
    `java.io.IOException`

### initParse

    protected void initParse()

  Initializes the state of the module for parsing.

  Overrides:
    `initParse` in class `ModuleBase`

### initNiso

    protected void initNiso()

  Initializes the constant portions of the niso metadata.

### readHeader

    protected boolean readHeader(RepInfo info)

### readAPP0

    protected void readAPP0(RepInfo info)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### readAPP1

    protected void readAPP1(RepInfo info)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### readAPP8

    protected void readAPP8(RepInfo info)
                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### readVer

    protected void readVer(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDTI

    protected void readDTI(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDTT

    protected void readDTT(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readSRS

    protected void readSRS(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### reportAppExt

    protected void reportAppExt(int dbyt,
                                RepInfo info)

### readSOF

    protected void readSOF(int dbyt,
                           RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDHP

    protected void readDHP(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readEXP

    protected void readEXP(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDRI

    protected void readDRI(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDQT

    protected void readDQT(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readDAC

    protected void readDAC(RepInfo info)
                    throws java.io.IOException

  Throws:
    `java.io.IOException`

### readJPEGExtension

    protected void readJPEGExtension(int dbyt,
                                     RepInfo info)
                              throws java.io.IOException

  Throws:
    `java.io.IOException`

### readComment

    protected void readComment(RepInfo info)
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

### buildCapProp

    protected Property buildCapProp(RepInfo info)

### buildTilingProp

    protected Property buildTilingProp(RepInfo info)

### buildExpandProp

    protected Property buildExpandProp(RepInfo info)

### readXMP

    protected Property readXMP(byte[] buf)

### extractExifNisoData

    protected void extractExifNisoData(NisoImageMetadata exifData)

### skipSegment

    protected boolean skipSegment(RepInfo info)
                           throws java.io.IOException

  Throws:
    `java.io.IOException`

### equalArray

    protected static boolean equalArray(int[] a,
                                        int[] b)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD