lava.riff
Class RiffInputStream

Details: RiffInputStream is a java.io.InputStream-based implementation of IRiffInput. In order to enable seeking while reading from the stream, RiffInputStream buffers every byte it reads from the underlying stream. Because this can require large amounts of memory for large streams, the client should call the free method whenever possible in order to release portions of the buffer that are no longer needed.

getPosition

Details: This method returns the read offset, or the position of the next byte to be read. The position reported may be greater than the length of the stream if it was previously set to be so. (See setPosition.)

setPosition

Details: This method sets the read offset, or the position of the next byte to be read, to newpos. Setting the position to a value greater than the length of the file is legal, and will not cause an error unless a read is subsequently attempted from that position.

read

Details: This method reads and returns the next BYTE, i.e., the BYTE pointed to by the read offset. The read offset is automatically incremented by 1. The BYTE is zero-extended into an int before it is returned. If a BYTE could not be read because the end of the data source was reached, -1 is returned.

read

Details: This method reads a consecutive run of BYTEs from the data source, beginning with the BYTE at the current position. The BYTEs are stored in dest beginning at the given offset (offset). Up to amount BYTEs are read and stored, but the actual number of BYTEs read may be less if the end of the sequence is reached. If BYTEs are read, the number of BYTEs read is returned, but if no BYTEs can be read, -1 is returned. The read offset is automatically advanced by the number of BYTEs read.

read

Details: This method reads a consecutive run of little-endian WORDs, or 16-bit integers, from the data source, beginning with the WORD at the current position. The WORDs are stored in dest beginning at the given offset (offset). Up to amount WORDs are read and stored, but the actual number of WORDs read may be less if the end of the sequence is reached. If WORDs are read, the number of WORDs read is returned, but if no WORDs can be read, -1 is returned. The read offset is automatically advanced by the number of BYTEs read.

read

Details: This method reads a consecutive run of little-endian DWORDs, or 32-bit integers, from the data source, beginning with the DWORD at the current position. The DWORDs are stored in dest beginning at the given offset (offset). Up to amount DWORDs are read and stored, but the actual number of DWORDs read may be less if the end of the sequence is reached. If DWORDs are read, the number of DWORDs read is returned, but if no DWORDs can be read, -1 is returned. The read offset is automatically advanced by the number of BYTEs read.

free

Details: This method advises this implementation that the given range of bytes can be unbuffered because the consumer has no need to read them again. Revisiting segments of this data source after they have been freed can cause an exception, return incorrect data, or simply cause undetected, unpredictable results.