WaveModule (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 WaveModule

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

All Implemented Interfaces:
  Module

    public class WaveModule

extends ModuleBase

Module for identification and validation of WAVE sound files. There is no published specification for WAVE files; this module is based on several Internet sources. WAVE format is a type of RIFF format. RIFF, in turn, is a variant on EA IFF 85.

Author:
  Gary McGath

Field Summary
`protected AESAudioMetadata` | `_aesMetadata`
`protected int` | `_blockAlign`
`protected Checksummer` | `_ckSummer` PRIVATE INSTANCE FIELDS.
`protected ChecksumInputStream` | `_cstream`
`protected java.io.DataInputStream` | `_dstream`
`protected ExifInfo` | `_exifInfo`
`protected java.util.List<Property>` | `_labeledText`
`protected java.util.List<Property>` | `_labels`
`protected Property` | `_metadata`
`protected java.util.List<Property>` | `_notes`
`protected java.util.List<Property>` | `_propList`
`protected java.util.List<Property>` | `_samples`
`protected boolean` | `broadcastExtChunkSeen`
`protected int` | `broadcastVersion`
`protected long` | `bytesRemaining`
`protected boolean` | `cartChunkSeen`
`protected int` | `compressionCode`
`protected boolean` | `cueChunkSeen`
`protected boolean` | `dataChunkSeen`
`protected boolean` | `factChunkSeen`
`protected boolean` | `firstSampleOffsetMarked`
`protected boolean` | `flagBroadcastWave`
`protected boolean` | `flagPCMWaveFormat`
`protected boolean` | `flagWaveFormatEx`
`protected boolean` | `flagWaveFormatExtensible`
`protected boolean` | `formatChunkSeen`
`protected boolean` | `instrumentChunkSeen`
`protected boolean` | `linkChunkSeen`
`protected boolean` | `mpegChunkSeen`
`protected long` | `numSamples`
`protected boolean` | `peakChunkSeen`
`protected long` | `sampleRate`

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

Method Summary
`void` | `addLabel(Property p)` Adds a Label property
`void` | `addLabeledText(Property p)` Adds a LabeledText property
`void` | `addListInfo(java.util.List l)` Adds the ListInfo property, which is a List of String Properties.
`void` | `addNote(Property p)` Adds a Note string
`void` | `addSample(Property p)` Adds a Sample property
`void` | `addSamples(long samples)` Add to the number of data bytes.
`void` | `addWaveProperty(Property prop)` Adds a Property to the WAVE metadata.
`Property` | `buildBitmaskProperty(int val, java.lang.String name, java.lang.String[] oneValueNames, java.lang.String[] zeroValueNames)` General function for adding a property with a 32-bit value, with two arrays of Strings to interpret 0 and 1 values as a bitmask.
`protected void` | `dupChunkError(RepInfo info, java.lang.String chunkName)`
`AESAudioMetadata` | `getAESMetadata()` Returns the module's AES metadata.
`int` | `getBlockAlign()` Returns the number of bytes needed per aligned sample.
`int` | `getCompressionCode()` Returns the compression code.
`ExifInfo` | `getExifInfo()` Returns the ExifInfo object.
`protected void` | `initParse()` Initializes the state of the module for parsing.
`void` | `markFirstSampleOffset()` 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 WAVE 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.
`protected boolean` | `readChunk(RepInfo info)` Reads a WAVE Chunk.
`int` | `readSignedInt(java.io.DataInputStream stream)` One-argument version of `readSignedInt`.
`long` | `readSignedLong(java.io.DataInputStream stream)` One-argument version of `readSignedLong`.
`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` | `setBlockAlign(int align)` Set the number of bytes that holds an aligned sample.
`void` | `setBroadcastVersion(int version)` Set the version from the Broadcast Extension chunk.
`void` | `setBroadcastWave(boolean b)` Set the profile flag for Broadcast Wave.
`void` | `setCompressionCode(int cf)` Set the compression format.
`void` | `setExifInfo(ExifInfo exifInfo)` Sets an ExifInfo object for the module.
`void` | `setPCMWaveFormat(boolean b)` Set the profile flag for PCMWAVEFORMAT.
`void` | `setSampleRate(long rate)` Set the sample rate.
`void` | `setWaveFormatEx(boolean b)` Set the profile flag for WAVEFORMATEX.
`void` | `setWaveFormatExtensible(boolean b)` Set the profile flag for WAVEFORMATEXTENSIBLE.

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<Property> _propList

### _notes

    protected java.util.List<Property> _notes

### _labels

    protected java.util.List<Property> _labels

### _labeledText

    protected java.util.List<Property> _labeledText

### _samples

    protected java.util.List<Property> _samples

### _aesMetadata

    protected AESAudioMetadata _aesMetadata

### bytesRemaining

    protected long bytesRemaining

### _blockAlign

    protected int _blockAlign

### _exifInfo

    protected ExifInfo _exifInfo

### compressionCode

    protected int compressionCode

### numSamples

    protected long numSamples

### sampleRate

    protected long sampleRate

### formatChunkSeen

    protected boolean formatChunkSeen

### factChunkSeen

    protected boolean factChunkSeen

### dataChunkSeen

    protected boolean dataChunkSeen

### instrumentChunkSeen

    protected boolean instrumentChunkSeen

### mpegChunkSeen

    protected boolean mpegChunkSeen

### cartChunkSeen

    protected boolean cartChunkSeen

### broadcastExtChunkSeen

    protected boolean broadcastExtChunkSeen

### peakChunkSeen

    protected boolean peakChunkSeen

### linkChunkSeen

    protected boolean linkChunkSeen

### cueChunkSeen

    protected boolean cueChunkSeen

### flagPCMWaveFormat

    protected boolean flagPCMWaveFormat

### flagWaveFormatEx

    protected boolean flagWaveFormatEx

### flagWaveFormatExtensible

    protected boolean flagWaveFormatExtensible

### flagBroadcastWave

    protected boolean flagBroadcastWave

### broadcastVersion

    protected int broadcastVersion

### firstSampleOffsetMarked

    protected boolean firstSampleOffsetMarked

Constructor Detail

### WaveModule

    public WaveModule()

  Instantiates an `WaveModule` 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 WAVE 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`

### markFirstSampleOffset

    public void markFirstSampleOffset()

  Marks the first sample offset as the current byte position, if it hasn't already been marked.

### setExifInfo

    public void setExifInfo(ExifInfo exifInfo)

  Sets an ExifInfo object for the module.

### setBlockAlign

    public void setBlockAlign(int align)

  Set the number of bytes that holds an aligned sample.

### getExifInfo

    public ExifInfo getExifInfo()

  Returns the ExifInfo object. If no ExifInfo object has been set, returns null.

### getCompressionCode

    public int getCompressionCode()

  Returns the compression code.

### getBlockAlign

    public int getBlockAlign()

  Returns the number of bytes needed per aligned sample.

### addWaveProperty

    public void addWaveProperty(Property prop)

  Adds a Property to the WAVE metadata.

### addLabel

    public void addLabel(Property p)

  Adds a Label property

### addLabeledText

    public void addLabeledText(Property p)

  Adds a LabeledText property

### addSample

    public void addSample(Property p)

  Adds a Sample property

### addNote

    public void addNote(Property p)

  Adds a Note string

### addListInfo

    public void addListInfo(java.util.List l)

  Adds the ListInfo property, which is a List of String Properties.

### readSignedLong

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

  One-argument version of `readSignedLong`. WAVE is always little-endian, so readSignedInt 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`. WAVE is always little-endian, so readUnsignedInt can unambiguously drop its endian argument.

  Throws:
    `java.io.IOException`

### readSignedInt

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

  One-argument version of `readSignedInt`. WAVE is always little-endian, so readSignedInt can unambiguously drop its endian argument.

  Throws:
    `java.io.IOException`

### readUnsignedShort

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

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

  Throws:
    `java.io.IOException`

### readSignedShort

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

  One-argument version of `readSignedShort`. WAVE is always little-endian, so readSignedShort can unambiguously drop its endian argument.

  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`

### setCompressionCode

    public void setCompressionCode(int cf)

  Set the compression format. Called from the Format chunk.

### addSamples

    public void addSamples(long samples)

  Add to the number of data bytes. This may be called multiple times to give a cumulative total.

### setSampleRate

    public void setSampleRate(long rate)

  Set the sample rate.

### setPCMWaveFormat

    public void setPCMWaveFormat(boolean b)

  Set the profile flag for PCMWAVEFORMAT.

### setWaveFormatEx

    public void setWaveFormatEx(boolean b)

  Set the profile flag for WAVEFORMATEX.

### setWaveFormatExtensible

    public void setWaveFormatExtensible(boolean b)

  Set the profile flag for WAVEFORMATEXTENSIBLE.

### setBroadcastWave

    public void setBroadcastWave(boolean b)

  Set the profile flag for Broadcast Wave.

### setBroadcastVersion

    public void setBroadcastVersion(int version)

  Set the version from the Broadcast Extension chunk.

### initParse

    protected void initParse()

  Initializes the state of the module for parsing.

  Overrides:
    `initParse` in class `ModuleBase`

### readChunk

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

  Reads a WAVE 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)

### buildBitmaskProperty

    public Property buildBitmaskProperty(int val,
                                         java.lang.String name,
                                         java.lang.String[] oneValueNames,
                                         java.lang.String[] zeroValueNames)

  General function for adding a property with a 32-bit value, with two arrays of Strings to interpret 0 and 1 values as a bitmask.

  Parameters:
    `val` - The bitmask
    `name` - The name for the Property
    `oneValueNames` - Array of names to use for '1' values
    `zeroValueNames` - Array of names to use for '0' values

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