javax.sound.midi
Class MidiMessage

java.lang.Object
  extended by javax.sound.midi.MidiMessage
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
MetaMessage, MidiMessageTest.TestMessage, ShortMessage, SysexMessage

public abstract class MidiMessage
extends java.lang.Object
implements java.lang.Cloneable

Base class for MIDI messages.


Method Summary
abstract  java.lang.Object clone()
          Create a copy of this MIDI message.
 int getLength()
          Returns the length of the whole message in bytes.
 byte[] getMessage()
          Return the complete message.
 int getStatus()
          Returns the status byte of the message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessage

public byte[] getMessage()
Return the complete message. This method makes a copy of data and returns a reference to the copy. The returned array contains only the bytes that form the MIDI message, even if data contains additional invalid bytes. This requirement also means that the length of the returned array is equal to length and equal to the value returned by getLength().

Returns:
An array of bytes representing the MIDI message.

getStatus

public int getStatus()
Returns the status byte of the message. This method returns the first byte of data, which is always the status byte.

Returns:
The status byte of the MIDI message stored in this object.

getLength

public int getLength()
Returns the length of the whole message in bytes. This returns the value of the member length. The value returned by this method is always equal to the length of the array returned by getMessage().

Returns:
The length of the MIDI message in bytes.
See Also:
length, getMessage()

clone

public abstract java.lang.Object clone()
Create a copy of this MIDI message.

Overrides:
clone in class java.lang.Object
Returns:
A new MidiMessage object that is a copy of this one.