Sharkysoft home

Class RiffStreamReader


public class RiffStreamReader
extends RiffChunkReader

Parses RIFF data source.

Details: A RiffStreamReader is a RiffChunkReader that provides access to the outermost chunk of a RIFF file. This the main interface through which a client begins processing a RIFF file.

Fields inherited from class lava.riff.RiffChunkReader
size, tag
Constructor Summary
RiffStreamReader(IRiffInput rais)
          Processes RIFF header.
Method Summary
 void close()
          Closes RIFF data source.
Methods inherited from class lava.riff.RiffChunkReader
free, freeAll, freeHeader, hasMoreData, readByte, readBytes, readChunk, readDword, readDwords, readString, readTag, readWord, readWords, reset, seek, skipBytes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public RiffStreamReader(IRiffInput rais)
Processes RIFF header.

Details: This constructor initializes a new RiffStreamReader to consume data from the given source. Before returning, this constructor performs an initial check to confirm that the input source appears to be a valid RIFF stream and throws an exception if the check fails. The check is performed as follows:

  1. The first four bytes of the file must be the ASCII characters 'R', 'I', 'F', 'F'.
  2. The next four bytes, taken as a little-endian, unsigned 32-bit integer (DWORD), should describe the length of the RIFF files outer data segment. If the DWORD is even, add 8 to it; if it is odd, add 9 to it. The resulting number should be equal to the length of the entire file.

If either of these two tests fail, a FileFormatException is thrown. If the input source is unable to report the length of the data source, the second test will not be performed.

file - the RIFF file to process
FileFormatException - if the file's header does not conform with the RIFF standard
Method Detail


public void close()
Closes RIFF data source.

Details: This method closes the RIFF data source. All chunk readers created by this instance, including inner chunk readers created by those chunk readers, and so on, become unusable.

Throws: - if an I/O error occurs

Sharkysoft home