org.niffty
Class RiffTimeSlice

java.lang.Object
  |
  +--org.niffty.RiffTimeSlice

public class RiffTimeSlice
extends java.lang.Object

A RiffTimeSlice provides static methods for encoding/decoding a TimeSlice using RIFF.


Method Summary
static void addMusicSymbols(RIFF parentInput, TimeSlice timeSlice)
          This reads chunks from parentInput's input stream until the next NIFF time slice or no more bytesRemaining in the input, adding the chunks to the timeSlice's music symbol list.
static TimeSlice maybeNew(RIFF parentInput)
          Peek into the parentInput's input stream and if the next item is a NIFF time slice with any type other than MEASURE_START (presumably type EVENT), return a new TimeSlice.
static MusicSymbol maybeNewAnyMusicSymbol(RIFF parentInput)
          Peek into the parentInput's input stream and if the next item is one of the recognized NIFF music symbols which subclass MusicSymbol, then return a new object of that subclass.
static TimeSlice newInstance(RIFF parentInput)
          Creates new TimeSlice from the parentInput's input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static TimeSlice newInstance(RIFF parentInput)
                             throws java.io.IOException,
                                    RIFFFormatException
Creates new TimeSlice from the parentInput's input stream. The next object in the input stream must be a time slice with a type any other than MEASURE_START (which means the type should be EVENT). After creating the TimeSlice, you can call addMusicSymbols() to store the music symbols for this time slice.

Parameters:
parentInput - the parent RIFF object being used to read the input stream
java.io.IOException
RIFFFormatException
See Also:
addMusicSymbols(org.niffty.RIFF, org.niffty.TimeSlice)

maybeNew

public static TimeSlice maybeNew(RIFF parentInput)
                          throws java.io.IOException,
                                 RIFFFormatException
Peek into the parentInput's input stream and if the next item is a NIFF time slice with any type other than MEASURE_START (presumably type EVENT), return a new TimeSlice. Otherwise, return null and leave the input stream unchanged.

Parameters:
parentInput - the parent RIFF object being used to read the input stream
java.io.IOException
RIFFFormatException

addMusicSymbols

public static void addMusicSymbols(RIFF parentInput,
                                   TimeSlice timeSlice)
                            throws java.io.IOException,
                                   RIFFFormatException
This reads chunks from parentInput's input stream until the next NIFF time slice or no more bytesRemaining in the input, adding the chunks to the timeSlice's music symbol list. If a music symbol is not recognized, this skips it. This stops at either a measure start or an event time slice.

Parameters:
parentInput - the parent RIFF object being used to read the input stream
timeSlice - the TimeSlice to which MusicSymbol objects are added.
java.io.IOException
RIFFFormatException
See Also:
MusicSymbol

maybeNewAnyMusicSymbol

public static MusicSymbol maybeNewAnyMusicSymbol(RIFF parentInput)
                                          throws java.io.IOException,
                                                 RIFFFormatException
Peek into the parentInput's input stream and if the next item is one of the recognized NIFF music symbols which subclass MusicSymbol, then return a new object of that subclass. Otherwise, return null and leave the input stream unchanged.

Parameters:
parentInput - the parent RIFF object being used to read the input stream
java.io.IOException
RIFFFormatException