FileDocCategorySizeDatePackage
SysexMessage.javaAPI DocAndroid 1.5 API3152Wed May 06 22:41:02 BST 2009javax.sound.midi

SysexMessage

public class SysexMessage extends MidiMessage

Fields Summary
public static final int
SPECIAL_SYSTEM_EXCLUSIVE
public static final int
SYSTEM_EXCLUSIVE
Constructors Summary
public SysexMessage()


      
        super(new byte[] {-16, -9});
    
protected SysexMessage(byte[] data)

        super(data);
    
Methods Summary
public java.lang.Objectclone()

        return new SysexMessage(this.getMessage());
    
public byte[]getData()

        byte[] bt = new byte[super.length - 1];
        for(int i = 1; i < super.length; i++) {
            bt[i-1] = super.data[i];
        }
        return bt;
    
public voidsetMessage(byte[] data, int length)

        //FIXME
        /*
         * if this exception throw out, the value of wrong status byte
         * should be the hexadecimal value
         */
        if(((data[0] & 0xFF) != SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) &&
                ((data[0] & 0xFF) != SysexMessage.SYSTEM_EXCLUSIVE)) {
            // sound.09=Invalid status byte for sysex message: {0}
            throw new InvalidMidiDataException(Messages.getString("sound.09",  //$NON-NLS-1$
                    data[0] & 0xFF));
        }
        super.setMessage(data, length);
    
public voidsetMessage(int status, byte[] data, int length)

        //FIXME
        /*
         * if this exception throw out, the value of wrong status byte
         * should be the hexadecimal value
         */
        if((status != SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE) &&
                (status != SysexMessage.SYSTEM_EXCLUSIVE)) {
            // sound.09=Invalid status byte for sysex message: {0}
            throw new InvalidMidiDataException(Messages.getString("sound.09",  //$NON-NLS-1$
                    status));
        }
        if((length < 0) || (length > data.length)) {
            // sound.03=length out of bounds: {0}
            throw new IndexOutOfBoundsException(Messages.getString("sound.03", length)); //$NON-NLS-1$
        }
        byte[] bt = new byte[length + 1];
        bt[0] = (byte) status;
        for(int i = 0; i < length; i++) {
            bt[i+1] = data[i];
        }
        super.setMessage(bt, length + 1);