Uses of Class javax.sound.midi.InvalidMidiDataException (Java Platform SE 8 )
Date: 2026-04-17

## Uses of Class
javax.sound.midi.InvalidMidiDataException

- Packages that use InvalidMidiDataException
  Package | Description
  --- | ---
  javax.sound.midi | Provides interfaces and classes for I/O, sequencing, and synthesis of MIDI (Musical Instrument Digital Interface) data.
  javax.sound.midi.spi | Supplies interfaces for service providers to implement when offering new MIDI devices, MIDI file readers and writers, or sound bank readers.

- - ### Uses of InvalidMidiDataException in javax.sound.midi

    Methods in javax.sound.midi that throw InvalidMidiDataException
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | ShortMessage.`getDataLength(int status)` Retrieves the number of data bytes associated with a particular status byte value.
    `static MidiFileFormat` | MidiSystem.`getMidiFileFormat(File file)` Obtains the MIDI file format of the specified `File`.
    `static MidiFileFormat` | MidiSystem.`getMidiFileFormat(InputStream stream)` Obtains the MIDI file format of the data in the specified input stream.
    `static MidiFileFormat` | MidiSystem.`getMidiFileFormat(URL url)` Obtains the MIDI file format of the data in the specified URL.
    `static Sequence` | MidiSystem.`getSequence(File file)` Obtains a MIDI sequence from the specified `File`.
    `static Sequence` | MidiSystem.`getSequence(InputStream stream)` Obtains a MIDI sequence from the specified input stream.
    `static Sequence` | MidiSystem.`getSequence(URL url)` Obtains a MIDI sequence from the specified URL.
    `static Soundbank` | MidiSystem.`getSoundbank(File file)` Constructs a `Soundbank` by reading it from the specified `File`.
    `static Soundbank` | MidiSystem.`getSoundbank(InputStream stream)` Constructs a MIDI sound bank by reading it from the specified stream.
    `static Soundbank` | MidiSystem.`getSoundbank(URL url)` Constructs a `Soundbank` by reading it from the specified URL.
    `void` | SysexMessage.`setMessage(byte[] data, int length)` Sets the data for the system exclusive message.
    `protected void` | MidiMessage.`setMessage(byte[] data, int length)` Sets the data for the MIDI message.
    `void` | ShortMessage.`setMessage(int status)` Sets the parameters for a MIDI message that takes no data bytes.
    `void` | SysexMessage.`setMessage(int status, byte[] data, int length)` Sets the data for the system exclusive message.
    `void` | MetaMessage.`setMessage(int type, byte[] data, int length)` Sets the message parameters for a `MetaMessage`.
    `void` | ShortMessage.`setMessage(int status, int data1, int data2)` Sets the parameters for a MIDI message that takes one or two data bytes.
    `void` | ShortMessage.`setMessage(int command, int channel, int data1, int data2)` Sets the short message parameters for a channel message which takes up to two data bytes.
    `void` | Sequencer.`setSequence(InputStream stream)` Sets the current sequence on which the sequencer operates.
    `void` | Sequencer.`setSequence(Sequence sequence)` Sets the current sequence on which the sequencer operates.

    Constructors in javax.sound.midi that throw InvalidMidiDataException
    Constructor and Description
    `MetaMessage(int type, byte[] data, int length)` Constructs a new `MetaMessage` and sets the message parameters.
    `Sequence(float divisionType, int resolution)` Constructs a new MIDI sequence with the specified timing division type and timing resolution.
    `Sequence(float divisionType, int resolution, int numTracks)` Constructs a new MIDI sequence with the specified timing division type, timing resolution, and number of tracks.
    `ShortMessage(int status)` Constructs a new `ShortMessage` which represents a MIDI message that takes no data bytes.
    `ShortMessage(int status, int data1, int data2)` Constructs a new `ShortMessage` which represents a MIDI message that takes up to two data bytes.
    `ShortMessage(int command, int channel, int data1, int data2)` Constructs a new `ShortMessage` which represents a channel MIDI message that takes up to two data bytes.
    `SysexMessage(byte[] data, int length)` Constructs a new `SysexMessage` and sets the data for the message.
    `SysexMessage(int status, byte[] data, int length)` Constructs a new `SysexMessage` and sets the data for the message.

  - ### Uses of InvalidMidiDataException in javax.sound.midi.spi

    Methods in javax.sound.midi.spi that throw InvalidMidiDataException
    Modifier and Type | Method and Description
    --- | ---
    `abstract MidiFileFormat` | MidiFileReader.`getMidiFileFormat(File file)` Obtains the MIDI file format of the `File` provided.
    `abstract MidiFileFormat` | MidiFileReader.`getMidiFileFormat(InputStream stream)` Obtains the MIDI file format of the input stream provided.
    `abstract MidiFileFormat` | MidiFileReader.`getMidiFileFormat(URL url)` Obtains the MIDI file format of the URL provided.
    `abstract Sequence` | MidiFileReader.`getSequence(File file)` Obtains a MIDI sequence from the `File` provided.
    `abstract Sequence` | MidiFileReader.`getSequence(InputStream stream)` Obtains a MIDI sequence from the input stream provided.
    `abstract Sequence` | MidiFileReader.`getSequence(URL url)` Obtains a MIDI sequence from the URL provided.
    `abstract Soundbank` | SoundbankReader.`getSoundbank(File file)` Obtains a soundbank object from the `File` provided.
    `abstract Soundbank` | SoundbankReader.`getSoundbank(InputStream stream)` Obtains a soundbank object from the `InputStream` provided.
    `abstract Soundbank` | SoundbankReader.`getSoundbank(URL url)` Obtains a soundbank object from the URL provided.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.