APIdia Launch Partner
Top Description Constructors Methods
javax.sound.midi.spi

public abstract Class MidiFileReader

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.StandardMidiFileReader
Imports
java.io.File, .IOException, .InputStream, java.net.URL, javax.sound.midi.InvalidMidiDataException, .MidiFileFormat, .Sequence

A MidiFileReader supplies MIDI file-reading services. Classes implementing this interface can parse the format information from one or more types of MIDI file, and can produce a Sequence object from files of these types.
Author
Kara Kytle
Since
1.3

Constructor Summary

AccessConstructor and Description
protected
MidiFileReader()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract MidiFileFormat

Returns:

a MidiFileFormat object describing the MIDI file format
getMidiFileFormat
(InputStream
the input stream from which file format information should be extracted
stream
)

Obtains the MIDI file format of the input stream provided.

public abstract MidiFileFormat

Returns:

a MidiFileFormat object describing the MIDI file format
getMidiFileFormat
(URL
the URL from which file format information should be extracted
url
)

Obtains the MIDI file format of the URL provided.

public abstract MidiFileFormat

Returns:

a MidiFileFormat object describing the MIDI file format
getMidiFileFormat
(File
the File from which file format information should be extracted
file
)

Obtains the MIDI file format of the File provided.

public abstract Sequence

Returns:

a Sequence object based on the MIDI file data contained in the input stream
getSequence
(InputStream
the input stream from which the Sequence should be constructed
stream
)

Obtains a MIDI sequence from the input stream provided.

public abstract Sequence

Returns:

a Sequence object based on the MIDI file data pointed to by the URL
getSequence
(URL
the URL for which the Sequence should be constructed
url
)

Obtains a MIDI sequence from the URL provided.

public abstract Sequence

Returns:

a Sequence object based on the MIDI file data pointed to by the File
getSequence
(File
the File from which the Sequence should be constructed
file
)

Obtains a MIDI sequence from the File provided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MidiFileReaderback to summary
protected MidiFileReader()

Constructor for subclasses to call.

Method Detail

getMidiFileFormatback to summary
public abstract MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException

Obtains the MIDI file format of the input stream provided. The stream must point to valid MIDI file data. In general, MIDI file readers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream:InputStream

the input stream from which file format information should be extracted

Returns:MidiFileFormat

a MidiFileFormat object describing the MIDI file format

Exceptions
InvalidMidiDataException:
if the stream does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if stream is null
See Also
InputStream#markSupported, InputStream#mark
getMidiFileFormatback to summary
public abstract MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException

Obtains the MIDI file format of the URL provided. The URL must point to valid MIDI file data.

Parameters
url:URL

the URL from which file format information should be extracted

Returns:MidiFileFormat

a MidiFileFormat object describing the MIDI file format

Exceptions
InvalidMidiDataException:
if the URL does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if url is null
getMidiFileFormatback to summary
public abstract MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException

Obtains the MIDI file format of the File provided. The File must point to valid MIDI file data.

Parameters
file:File

the File from which file format information should be extracted

Returns:MidiFileFormat

a MidiFileFormat object describing the MIDI file format

Exceptions
InvalidMidiDataException:
if the File does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if file is null
getSequenceback to summary
public abstract Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException

Obtains a MIDI sequence from the input stream provided. The stream must point to valid MIDI file data. In general, MIDI file readers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream:InputStream

the input stream from which the Sequence should be constructed

Returns:Sequence

a Sequence object based on the MIDI file data contained in the input stream

Exceptions
InvalidMidiDataException:
if the stream does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if stream is null
See Also
InputStream#markSupported, InputStream#mark
getSequenceback to summary
public abstract Sequence getSequence(URL url) throws InvalidMidiDataException, IOException

Obtains a MIDI sequence from the URL provided. The URL must point to valid MIDI file data.

Parameters
url:URL

the URL for which the Sequence should be constructed

Returns:Sequence

a Sequence object based on the MIDI file data pointed to by the URL

Exceptions
InvalidMidiDataException:
if the URL does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if url is null
getSequenceback to summary
public abstract Sequence getSequence(File file) throws InvalidMidiDataException, IOException

Obtains a MIDI sequence from the File provided. The File must point to valid MIDI file data.

Parameters
file:File

the File from which the Sequence should be constructed

Returns:Sequence

a Sequence object based on the MIDI file data pointed to by the File

Exceptions
InvalidMidiDataException:
if the File does not point to valid MIDI file data recognized by the system
IOException:
if an I/O exception occurs
NullPointerException:
if file is null