edu.harvard.hul.ois.jhove.module.iff
Class Chunk

java.lang.Object
  extended by edu.harvard.hul.ois.jhove.module.iff.Chunk
Direct Known Subclasses:
ApplicationChunk, AudioRecChunk, AXMLChunk, BroadcastExtChunk, CartChunk, CommentsChunk, CommonChunk, CueChunk, DataChunk, ExifMakerNoteChunk, ExifStringChunk, ExifUserCommentChunk, ExifVersionChunk, FactChunk, FormatChunk, FormatVersionChunk, InstrumentChunk, InstrumentChunk, LabeledTextChunk, LinkChunk, ListInfoTextChunk, MarkerChunk, MidiChunk, MpegChunk, PeakEnvelopeChunk, SampleChunk, SaxelChunk, SimpleTextChunk, SoundDataChunk, Superchunk, TextChunk

public abstract class Chunk
extends java.lang.Object

Abstract superclass for IFF/AIFF chunks.

Author:
Gary McGath

Field Summary
protected  java.io.DataInputStream _dstream
           
protected  ModuleBase _module
           
protected  long bytesLeft
           
 
Constructor Summary
Chunk(ModuleBase module, ChunkHeader hdr, java.io.DataInputStream dstrm)
          Constructor.
 
Method Summary
protected  java.lang.String byteBufString(byte[] b)
          Convert a byte buffer cleanly to an ASCII string.
abstract  boolean readChunk(RepInfo info)
          Reads a chunk and puts appropriate information into the RepInfo object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_module

protected ModuleBase _module

bytesLeft

protected long bytesLeft

_dstream

protected java.io.DataInputStream _dstream
Constructor Detail

Chunk

public Chunk(ModuleBase module,
             ChunkHeader hdr,
             java.io.DataInputStream dstrm)
Constructor.

Parameters:
module - The Module under which this was called
hdr - The header for this chunk
dstrm - The stream from which the data are being read
Method Detail

readChunk

public abstract boolean readChunk(RepInfo info)
                           throws java.io.IOException,
                                  JhoveException
Reads a chunk and puts appropriate information into the RepInfo object.

Parameters:
info - RepInfo object to receive information
Returns:
false if the chunk is structurally invalid, otherwise true
Throws:
JhoveException
java.io.IOException

byteBufString

protected java.lang.String byteBufString(byte[] b)
Convert a byte buffer cleanly to an ASCII string. This is used for fixed-allocation strings in Broadcast WAVE chunks, and might have uses elsewhere. If a string is shorter than its fixed allocation, we're guaranteed only that there is a null terminating the string, and noise could follow it. So we can't use the byte buffer constructor for a string.