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

public abstract Class MidiFileWriter

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.media.sound.StandardMidiFileWriter
Imports
java.io.File, .IOException, .OutputStream, java.util.Arrays, javax.sound.midi.Sequence

A MidiFileWriter supplies MIDI file-writing services. Classes that implement this interface can write one or more types of MIDI file from a Sequence object.
Author
Kara Kytle
Since
1.3

Constructor Summary

AccessConstructor and Description
protected
MidiFileWriter()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract int[]

Returns:

array of file types. If no file types are supported, an array of length 0 is returned.
getMidiFileTypes
()

Obtains the set of MIDI file types for which file writing support is provided by this file writer.

public abstract int[]

Returns:

array of file types. If no file types are supported, returns an array of length 0.
getMidiFileTypes
(Sequence
the sequence for which MIDI file type support is queried
sequence
)

Obtains the file types that this file writer can write from the sequence specified.

public boolean

Returns:

true if the file type is supported, otherwise false
isFileTypeSupported
(final int
the file type for which write capabilities are queried
fileType
)

Indicates whether file writing support for the specified MIDI file type is provided by this file writer.

public boolean

Returns:

true if the file type is supported for this sequence, otherwise false
isFileTypeSupported
(final int
the file type for which write capabilities are queried
fileType
,
final Sequence
the sequence for which file writing support is queried
sequence
)

Indicates whether a MIDI file of the file type specified can be written from the sequence indicated.

public abstract int

Returns:

the number of bytes written to the output stream
write
(Sequence
sequence containing MIDI data to be written to the file
in
,
int
type of the file to be written to the output stream
fileType
,
OutputStream
stream to which the file data should be written
out
)

Writes a stream of bytes representing a MIDI file of the file type indicated to the output stream provided.

public abstract int

Returns:

the number of bytes written to the file
write
(Sequence
sequence containing MIDI data to be written to the external file
in
,
int
type of the file to be written to the external file
fileType
,
File
external file to which the file data should be written
out
)

Writes a stream of bytes representing a MIDI file of the file type indicated to the external file provided.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MidiFileWriterback to summary
protected MidiFileWriter()

Constructor for subclasses to call.

Method Detail

getMidiFileTypesback to summary
public abstract int[] getMidiFileTypes()

Obtains the set of MIDI file types for which file writing support is provided by this file writer.

Returns:int[]

array of file types. If no file types are supported, an array of length 0 is returned.

getMidiFileTypesback to summary
public abstract int[] getMidiFileTypes(Sequence sequence)

Obtains the file types that this file writer can write from the sequence specified.

Parameters
sequence:Sequence

the sequence for which MIDI file type support is queried

Returns:int[]

array of file types. If no file types are supported, returns an array of length 0.

Exceptions
NullPointerException:
if sequence is null
isFileTypeSupportedback to summary
public boolean isFileTypeSupported(final int fileType)

Indicates whether file writing support for the specified MIDI file type is provided by this file writer.

Parameters
fileType:int

the file type for which write capabilities are queried

Returns:boolean

true if the file type is supported, otherwise false

isFileTypeSupportedback to summary
public boolean isFileTypeSupported(final int fileType, final Sequence sequence)

Indicates whether a MIDI file of the file type specified can be written from the sequence indicated.

Parameters
fileType:int

the file type for which write capabilities are queried

sequence:Sequence

the sequence for which file writing support is queried

Returns:boolean

true if the file type is supported for this sequence, otherwise false

Exceptions
NullPointerException:
if sequence is null
writeback to summary
public abstract int write(Sequence in, int fileType, OutputStream out) throws IOException

Writes a stream of bytes representing a MIDI file of the file type indicated to the output stream provided.

Parameters
in:Sequence

sequence containing MIDI data to be written to the file

fileType:int

type of the file to be written to the output stream

out:OutputStream

stream to which the file data should be written

Returns:int

the number of bytes written to the output stream

Exceptions
IOException:
if an I/O exception occurs
IllegalArgumentException:
if the file type is not supported by this file writer
NullPointerException:
if in or out are null
See Also
isFileTypeSupported(int, Sequence), getMidiFileTypes(Sequence)
writeback to summary
public abstract int write(Sequence in, int fileType, File out) throws IOException

Writes a stream of bytes representing a MIDI file of the file type indicated to the external file provided.

Parameters
in:Sequence

sequence containing MIDI data to be written to the external file

fileType:int

type of the file to be written to the external file

out:File

external file to which the file data should be written

Returns:int

the number of bytes written to the file

Exceptions
IOException:
if an I/O exception occurs
IllegalArgumentException:
if the file type is not supported by this file writer
NullPointerException:
if in or out are null
See Also
isFileTypeSupported(int, Sequence), getMidiFileTypes(Sequence)