List of usage examples for javax.sound.midi MetaMessage getLength
public int getLength()
From source file:de.ailis.midi4js.MessageReceiver.java
/** * Processes a meta message./* www.j ava2s.c o m*/ * * @param message * The message to process. * @param json * The JSON stringer. * @throws JSONException * When JSON output fails. */ private void processMetaMessage(final MetaMessage message, final JSONStringer json) throws JSONException { json.key("class").value("MetaMessage"); json.key("type").value(message.getType()); json.key("data"); json.array(); final byte[] data = message.getMessage(); final int max = Math.min(data.length, message.getLength()); for (int i = 0; i < max; i++) json.value(data[i] & 0xff); json.endArray(); }