This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.sound.midi
class SysexMessage

java.lang.Object extended by javax.sound.midi.MidiMessage extended by javax.sound.midi.SysexMessage
All Implemented Interfaces:
Cloneable

Most common way to construct:

SysexMessage sm = new SysexMessage();

Based on 14 examples


public class SysexMessage
extends MidiMessage

A SysexMessage object represents a MIDI system exclusive message.

When a system exclusive message is read from a MIDI file, it always has a defined length. Data from a system exclusive message from a MIDI file should be stored in the data array of a SysexMessage as follows: the system exclusive message status byte (0xF0 or 0xF7), all message data bytes, and finally the end-of-exclusive flag (0xF7). The length reported by the SysexMessage object is therefore the length of the system exclusive data plus two: one byte for the status byte and one for the end-of-exclusive flag.

As dictated by the Standard MIDI Files specification, two status byte values are legal for a SysexMessage read from a MIDI file:

When Java Sound is used to handle system exclusive data that is being received using MIDI wire protocol, it should place the data in one or more SysexMessages. In this case, the length of the system exclusive data is not known in advance; the end of the system exclusive data is marked by an end-of-exclusive flag (0xF7) in the MIDI wire byte stream.

The first SysexMessage object containing data for a particular system exclusive message should have the status value 0xF0. If this message contains all the system exclusive data for the message, it should end with the status byte 0xF7 (EOX). Otherwise, additional system exclusive data should be sent in one or more SysexMessages with a status value of 0xF7. The SysexMessage containing the last of the data for the system exclusive message should end with the value 0xF7 (EOX) to mark the end of the system exclusive message.

If system exclusive data from SysexMessages objects is being transmitted using MIDI wire protocol, only the initial 0xF0 status byte, the system exclusive data itself, and the final 0xF7 (EOX) byte should be propagated; any 0xF7 status bytes used to indicate that a SysexMessage contains continuing system exclusive data should not be propagated via MIDI wire protocol.


Field Summary
static int SPECIAL_SYSTEM_EXCLUSIVE
          Status byte for Special System Exclusive message (0xF7, or 247), which is used in MIDI files.
static int SYSTEM_EXCLUSIVE
          Status byte for System Exclusive message (0xF0, or 240).
 
Fields inherited from class javax.sound.midi.MidiMessage
data, length
 
Constructor Summary
 

          Constructs a new SysexMessage.
protected
SysexMessage(byte[] data)

          Constructs a new SysexMessage.
 
Method Summary
 Object

          Creates a new object of the same class and with the same contents as this object.
 byte[]

          Obtains a copy of the data for the system exclusive message.
 void
setMessage(byte[] data, int length)

          Sets the data for the system exclusive message.
 void
setMessage(int status, byte[] data, int length)

          Sets the data for the system exclusive message.
 
Methods inherited from class javax.sound.midi.MidiMessage
clone, getLength, getMessage, getStatus, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIAL_SYSTEM_EXCLUSIVE

public static final int SPECIAL_SYSTEM_EXCLUSIVE
Status byte for Special System Exclusive message (0xF7, or 247), which is used in MIDI files. It has the same value as END_OF_EXCLUSIVE, which is used in the real-time "MIDI wire" protocol.

SYSTEM_EXCLUSIVE

public static final int SYSTEM_EXCLUSIVE
Status byte for System Exclusive message (0xF0, or 240).
Constructor Detail

SysexMessage

public SysexMessage()
Constructs a new SysexMessage. The contents of the new message are guaranteed to specify a valid MIDI message. Subsequently, you may set the contents of the message using one of the setMessage methods.


SysexMessage

protected SysexMessage(byte[] data)
Constructs a new SysexMessage.

Parameters:
data - an array of bytes containing the complete message. The message data may be changed using the setMessage method.
Method Detail

clone

public Object clone()
Creates a new object of the same class and with the same contents as this object.

Overrides:
clone in class MidiMessage
Returns:
a clone of this instance

getData

public byte[] getData()
Obtains a copy of the data for the system exclusive message. The returned array of bytes does not include the status byte.

Returns:
array containing the system exclusive message data.

setMessage

public void setMessage(byte[] data,
                       int length)
                throws InvalidMidiDataException
Sets the data for the system exclusive message. The first byte of the data array must be a valid system exclusive status byte (0xF0 or 0xF7).

Overrides:
setMessage in class MidiMessage
Parameters:
data - the system exclusive message data
length - the length of the valid message data in the array, including the status byte.
Throws:
InvalidMidiDataException

setMessage

public void setMessage(int status,
                       byte[] data,
                       int length)
                throws InvalidMidiDataException
Sets the data for the system exclusive message.

Parameters:
status - the status byte for the message (0xF0 or 0xF7)
data - the system exclusive message data
length - the length of the valid message data in the array
Throws:
InvalidMidiDataException


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.