AiffModule (JHOVE Documentation)
Date: 2013-09-08

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 AiffModule

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

All Implemented Interfaces:
  Module

    public class AiffModule

extends ModuleBase

Module for identification and validation of AIFF files. Supports AIFF and AIFF-C.

Author:
  Gary McGath

Field Summary
`protected AESAudioMetadata` | `_aesMetadata`
`protected java.util.List` | `_annotationList`
`protected Checksummer` | `_ckSummer` PRIVATE Instance FIELDS.
`protected ChecksumInputStream` | `_cstream`
`protected java.io.DataInputStream` | `_dstream`
`protected Property` | `_metadata`
`protected java.util.List` | `_midiList`
`protected java.util.List` | `_propList`
`protected java.util.List` | `_saxelList`
`static int` | `AIFCTYPE`
`static int` | `AIFFTYPE`
`protected boolean` | `audioRecChunkSeen`
`protected boolean` | `authorChunkSeen`
`protected long` | `bytesRemaining`
`protected boolean` | `commentsChunkSeen`
`protected boolean` | `commonChunkSeen`
`protected boolean` | `copyrightChunkSeen`
`protected int` | `fileType`
`protected boolean` | `firstSampleOffsetMarked`
`protected boolean` | `formatVersionChunkSeen`
`protected boolean` | `instrumentChunkSeen`
`protected boolean` | `markerChunkSeen`
`protected boolean` | `nameChunkSeen`
`protected boolean` | `soundChunkSeen`
`protected boolean` | `thisFileBigEndian`

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
`AiffModule()` Instantiates an `AiffModule` object.

Method Summary
`void` | `addAiffProperty(Property prop)` Adds a Property to the AIFF metadata.
`void` | `addAnnotation(Property prop)` Adds an Annotation Property to the annotation list.
`void` | `addMidi(Property prop)` Adds a MIDI Property to the MIDI list.
`void` | `addSaxel(Property prop)` Adds a Saxel Property to the saxel list.
`protected void` | `dupChunkError(RepInfo info, java.lang.String chunkName)`
`AESAudioMetadata` | `getAESMetadata()` Returns the module's AES metadata.
`int` | `getFileType()` Returns the filetype, which is AIFFTYPE or AIFCTYPE.
`protected void` | `initParse()` Initializes the state of the module for parsing.
`void` | `markFirstSampleOffset(long offset)` Marks the first sample offset as the current byte position, if it hasn't already been marked.
`int` | `parse(java.io.InputStream stream, RepInfo info, int parseIndex)` Parses the content of a purported AIFF digital object and stores the results in RepInfo.
`java.lang.String` | `read4Chars(java.io.DataInputStream stream)` Reads 4 bytes and concatenates them into a String.
`double` | `read80BitDouble(java.io.DataInputStream stream)` This reads an 80-bit SANE number, aka IEEE 754 extended double.
`protected boolean` | `readChunk(RepInfo info)` Reads an AIFF Chunk.
`protected boolean` | `readFileType(RepInfo info)` Reads the file type.
`java.lang.String` | `readPascalString(java.io.DataInputStream stream)` Reads a Pascal string.
`int` | `readSignedShort(java.io.DataInputStream stream)` One-argument version of `readSignedShort`.
`long` | `readUnsignedInt(java.io.DataInputStream stream)` One-argument version of `readUnsignedInt`.
`int` | `readUnsignedShort(java.io.DataInputStream stream)` One-argument version of `readUnsignedShort`.
`void` | `setEndian(boolean bigEndian)` Sets the endian-ness.
`java.util.Date` | `timestampToDate(long timestamp)` Converts a Macintosh-style timestamp (seconds since January 1, 1904) into a Java date.

Methods inherited from class edu.harvard.hul.ois.jhove.ModuleBase
`addIntegerProperty, addIntegerProperty, applyDefaultParams, calcRAChecksum, checkSignatures, 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

### _ckSummer

    protected Checksummer _ckSummer

  PRIVATE Instance FIELDS.

### _cstream

    protected ChecksumInputStream _cstream

### _dstream

    protected java.io.DataInputStream _dstream

### _metadata

    protected Property _metadata

### _propList

    protected java.util.List _propList

### _aesMetadata

    protected AESAudioMetadata _aesMetadata

### _annotationList

    protected java.util.List _annotationList

### _midiList

    protected java.util.List _midiList

### _saxelList

    protected java.util.List _saxelList

### bytesRemaining

    protected long bytesRemaining

### soundChunkSeen

    protected boolean soundChunkSeen

### formatVersionChunkSeen

    protected boolean formatVersionChunkSeen

### instrumentChunkSeen

    protected boolean instrumentChunkSeen

### commonChunkSeen

    protected boolean commonChunkSeen

### commentsChunkSeen

    protected boolean commentsChunkSeen

### nameChunkSeen

    protected boolean nameChunkSeen

### authorChunkSeen

    protected boolean authorChunkSeen

### copyrightChunkSeen

    protected boolean copyrightChunkSeen

### markerChunkSeen

    protected boolean markerChunkSeen

### audioRecChunkSeen

    protected boolean audioRecChunkSeen

### firstSampleOffsetMarked

    protected boolean firstSampleOffsetMarked

### fileType

    protected int fileType

### thisFileBigEndian

    protected boolean thisFileBigEndian

### AIFFTYPE

    public static final int AIFFTYPE

See Also:
  Constant Field Values

### AIFCTYPE

    public static final int AIFCTYPE

See Also:
  Constant Field Values

Constructor Detail

### AiffModule

    public AiffModule()

  Instantiates an `AiffModule` object.

Method Detail

### parse

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

  Parses the content of a purported AIFF digital object and stores the results in RepInfo.

  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`

### setEndian

    public void setEndian(boolean bigEndian)

  Sets the endian-ness. `true` indicates big-endian, and `false` means little-endian. This is needed because chunk data can change the usual little-endian byte order to big-endian.

### addAiffProperty

    public void addAiffProperty(Property prop)

  Adds a Property to the AIFF metadata.

### addAnnotation

    public void addAnnotation(Property prop)

  Adds an Annotation Property to the annotation list. This will get put into an Annotations Property.

### addSaxel

    public void addSaxel(Property prop)

  Adds a Saxel Property to the saxel list. This will get put into a Saxels Property.

### addMidi

    public void addMidi(Property prop)

  Adds a MIDI Property to the MIDI list. This will get put into a MIDIData Property.

### initParse

    protected void initParse()

  Initializes the state of the module for parsing.

  Overrides:
    `initParse` in class `ModuleBase`

### readUnsignedInt

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

  One-argument version of `readUnsignedInt`.

  Throws:
    `java.io.IOException`

### readUnsignedShort

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

  One-argument version of `readUnsignedShort`.

  Throws:
    `java.io.IOException`

### readSignedShort

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

  One-argument version of `readSignedShort`.

  Throws:
    `java.io.IOException`

### read80BitDouble

    public double read80BitDouble(java.io.DataInputStream stream)
                           throws java.io.IOException

  This reads an 80-bit SANE number, aka IEEE 754 extended double.

  Throws:
    `java.io.IOException`

### read4Chars

    public java.lang.String read4Chars(java.io.DataInputStream stream)
                                throws java.io.IOException

  Reads 4 bytes and concatenates them into a String. This pattern is used for ID's of various kinds.

  Throws:
    `java.io.IOException`

### readPascalString

    public java.lang.String readPascalString(java.io.DataInputStream stream)
                                      throws java.io.IOException

  Reads a Pascal string. A Pascal string is one whose count is given in the first byte. The count is exclusive of the count byte itself. A Pascal string can have a maximum of 255 characters. If the count of a Pascal string is even (meaning the total number of bytes is odd), there will be a pad byte to skip, so that the next item can start on an even boundary. We assume the string will be in ASCII or Macintosh encoding.

  Throws:
    `java.io.IOException`

### timestampToDate

    public java.util.Date timestampToDate(long timestamp)

  Converts a Macintosh-style timestamp (seconds since January 1, 1904) into a Java date. The timestamp is treated as a time in the default localization. Depending on that localization, there may be some variation in the exact hour of the date returned, e.g., due to daylight savings time.

### getFileType

    public int getFileType()

  Returns the filetype, which is AIFFTYPE or AIFCTYPE.

### markFirstSampleOffset

    public void markFirstSampleOffset(long offset)

  Marks the first sample offset as the current byte position, if it hasn't already been marked. The SSND chunk offset value must be added to the current byte offset for a correct value.

### readFileType

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

  Reads the file type. Broken out from parse(). If it is not a valid file type, returns false.

  Throws:
    `java.io.IOException`

### readChunk

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

  Reads an AIFF Chunk.

  Throws:
    `java.io.IOException`

### getAESMetadata

    public AESAudioMetadata getAESMetadata()

  Returns the module's AES metadata.

### dupChunkError

    protected void dupChunkError(RepInfo info,
                                 java.lang.String chunkName)

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