178 * length of the data for the meta message is the length of the array. Note
179 * that the length of the entire message includes the status byte and the
180 * meta message type byte, and therefore may be longer than the returned
181 * array.
182 *
183 * @return array containing the meta message data
184 * @see MidiMessage#getLength
185 */
186 public byte[] getData() {
187 byte[] returnedArray = new byte[dataLength];
188 System.arraycopy(data, (length - dataLength), returnedArray, 0, dataLength);
189 return returnedArray;
190 }
191
192 /**
193 * Creates a new object of the same class and with the same contents as this
194 * object.
195 *
196 * @return a clone of this instance
197 */
198 public Object clone() {
199 byte[] newData = new byte[length];
200 System.arraycopy(data, 0, newData, 0, newData.length);
201
202 MetaMessage event = new MetaMessage(newData);
203 return event;
204 }
205
206 // HELPER METHODS
207
208 private int getVarIntLength(long value) {
209 int length = 0;
210 do {
211 value = value >> 7;
212 length++;
213 } while (value > 0);
214 return length;
215 }
216
217 private static final long mask = 0x7F;
|
178 * length of the data for the meta message is the length of the array. Note
179 * that the length of the entire message includes the status byte and the
180 * meta message type byte, and therefore may be longer than the returned
181 * array.
182 *
183 * @return array containing the meta message data
184 * @see MidiMessage#getLength
185 */
186 public byte[] getData() {
187 byte[] returnedArray = new byte[dataLength];
188 System.arraycopy(data, (length - dataLength), returnedArray, 0, dataLength);
189 return returnedArray;
190 }
191
192 /**
193 * Creates a new object of the same class and with the same contents as this
194 * object.
195 *
196 * @return a clone of this instance
197 */
198 @Override
199 public Object clone() {
200 byte[] newData = new byte[length];
201 System.arraycopy(data, 0, newData, 0, newData.length);
202
203 MetaMessage event = new MetaMessage(newData);
204 return event;
205 }
206
207 // HELPER METHODS
208
209 private int getVarIntLength(long value) {
210 int length = 0;
211 do {
212 value = value >> 7;
213 length++;
214 } while (value > 0);
215 return length;
216 }
217
218 private static final long mask = 0x7F;
|