Module java.desktop

Class MidiFileFormat

java.lang.Object
javax.sound.midi.MidiFileFormat

public class MidiFileFormat
extends Object
A MidiFileFormat object encapsulates a MIDI file's type, as well as its length and timing information.

A MidiFileFormat object can include a set of properties. A property is a pair of key and value: the key is of type String, the associated property value is an arbitrary object. Properties specify additional informational meta data (like a author, or copyright). Properties are optional information, and file reader and file writer implementations are not required to provide or recognize properties.

The following table lists some common properties that should be used in implementations:

MIDI File Format Properties
Property key Value type Description
"author" String name of the author of this file
"title" String title of this file
"copyright" String copyright message
"date" Date date of the recording or release
"comment" String an arbitrary text
See Also:
MidiSystem.getMidiFileFormat(java.io.File), Sequencer.setSequence(java.io.InputStream stream)
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected int byteLength
    The length of the MIDI file in bytes.
    protected float divisionType
    The division type of the MIDI file.
    protected long microsecondLength
    The duration of the MIDI file in microseconds.
    protected int resolution
    The timing resolution of the MIDI file.
    protected int type
    The type of MIDI file.
    static int UNKNOWN_LENGTH
    Represents unknown length.
  • Constructor Summary

    Constructors 
    Constructor Description
    MidiFileFormat​(int type, float divisionType, int resolution, int bytes, long microseconds)
    Constructs a MidiFileFormat.
    MidiFileFormat​(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String,​Object> properties)
    Construct a MidiFileFormat with a set of properties.
  • Method Summary

    Modifier and Type Method Description
    int getByteLength()
    Obtains the length of the MIDI file, expressed in 8-bit bytes.
    float getDivisionType()
    Obtains the timing division type for the MIDI file.
    long getMicrosecondLength()
    Obtains the length of the MIDI file, expressed in microseconds.
    Object getProperty​(String key)
    Obtain the property value specified by the key.
    int getResolution()
    Obtains the timing resolution for the MIDI file.
    int getType()
    Obtains the MIDI file type.
    Map<String,​Object> properties()
    Obtain an unmodifiable map of properties.

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait