public void processRiff ( @ NotNull final SequentialReader reader , @ NotNull final RiffHandler handler ) throws RiffProcessingException , IOException { // RIFF files are always little-endian reader . setMotorolaByteOrder ( false ) ; // PROCESS FILE HEADER final String fileFourCC = reader . getString ( 4 ) ; if ( ! fileFourCC . equals ( "RIFF" ) ) throw new RiffProcessingException ( "Invalid RIFF header: " + fileFourCC ) ; // The total size of the chunks that follow plus 4 bytes for the FourCC final int fileSize = reader . getInt32 ( ) ; int sizeLeft = fileSize ; final String identifier = reader . getString ( 4 ) ; sizeLeft -= 4 ; if ( ! handler . shouldAcceptRiffIdentifier ( identifier ) ) return ; // PROCESS CHUNKS processChunks ( reader , sizeLeft , handler ) ; }
Processes a RIFF data sequence .