public final class MidiMessageFormatter extends Object
Modifier and Type | Method and Description |
---|---|
static String |
hexDump(byte[] d,
int offset,
int len,
int bytes)
convert a byte array into a hexa-dump string.
|
static String |
hexDump(byte[] d,
int offset,
int len,
int bytes,
boolean wantspaces)
convert a byte array into a hexa-dump string, with or without spaces
between the bytes.
|
static String |
hexDump(byte[] d,
int offset,
int len,
int bytes,
boolean addresses,
boolean characters)
convert a byte array into a string of hex values, optionally including
their character equivalents and/or the address/offset of the beginning of
the line.
|
static String |
hexDump(byte[] d,
int offset,
int len,
int bytes,
int addressLength,
boolean characters) |
static String |
hexDumpOneLine(byte[] d,
int offset,
int len,
int bytes)
convert a byte array into a one-line hexa-dump string.
|
static String |
midiMessageToString(MidiMessage m,
boolean completeMessage)
convert
MidiMessage into a string. |
static String |
shortMessageToString(ShortMessage m)
Convert
ShortMessage into a hexa-dump string. |
static String |
statusString(MidiMessage m)
Return a
String of the name of status byte of a
MidiMessage . |
static String |
sysexMessageToString(SysexMessage m)
Convert
SysexMessage into a hexa-dump string. |
static String |
sysexMessageToString(SysexMessage m,
int bytes)
Convert
SysexMessage into a hexa-dump string. |
public static String hexDump(byte[] d, int offset, int len, int bytes, boolean wantspaces)
d
- a byte[]
array to be converted.offset
- array index from which dump starts.len
- number of bytes to be dumped. If -1, dumps to the end of the
array.bytes
- number of bytes per line. If equal or less than 0, no newlines
are inserted.wantspaces
- whether or not to insert spaces between bytespublic static String hexDump(byte[] d, int offset, int len, int bytes, int addressLength, boolean characters)
public static String hexDump(byte[] d, int offset, int len, int bytes, boolean addresses, boolean characters)
addresses
is true, then the hex
representation of the offset will be put at the beginning of each line.
For example: 013A0 - 65 78 61 6D 70 6C 65 01 - EXAMPLE. 013A8 - EF 31 38
F3 F1 65 64 63 - .18..EDC 013B0 - 38 34 36 37 38 31 37 37 - 84678177 If
len
is positive non-zero, only len
bytes will
be represented on each line.d
- a byte[]
array to be converted.offset
- array index from which dump starts.len
- number of bytes to be dumped. If -1, dumps to the end of the
array.bytes
- number of columns (bytes) to put in each line. If less than or
equal to zero, no line-breaks are inserted.public static String hexDump(byte[] d, int offset, int len, int bytes)
d
- a byte[]
array to be converted.offset
- array index from which dump starts.len
- number of bytes to be dumped. If -1, dumps to the end of the
array.bytes
- number of bytes per line. If equal or less than 0, no newlines
are inserted.public static String hexDumpOneLine(byte[] d, int offset, int len, int bytes)
len
, it will have the inner portion removed and
replaced with dots, for example: "00 01 03 04 05 .. 7d 7e 7f"d
- a byte[]
array to be converted.offset
- array index from which dump starts.len
- number of bytes to be dumped. If -1, dumps to the end of the
array.bytes
- number of columns (bytes) to put in the one-line string.public static String sysexMessageToString(SysexMessage m, int bytes)
SysexMessage
into a hexa-dump string.m
- a SysexMessage
valuebytes
- number of bytes per line. If equal or less than 0, no newlines
are inserted.String
valuepublic static String sysexMessageToString(SysexMessage m) throws InvalidMidiDataException
SysexMessage
into a hexa-dump string. If the length
is longer than 16bytes, bytes of middle of the array are not ignored.m
- a SysexMessage
valueString
valueInvalidMidiDataException
- if an error occurspublic static String shortMessageToString(ShortMessage m) throws InvalidMidiDataException
ShortMessage
into a hexa-dump string.m
- a ShortMessage
valueString
valueInvalidMidiDataException
- if an error occurspublic static String statusString(MidiMessage m) throws InvalidMidiDataException
String
of the name of status byte of a
MidiMessage
.m
- a MidiMessage
valueString
valueInvalidMidiDataException
- if an error occurspublic static String midiMessageToString(MidiMessage m, boolean completeMessage) throws InvalidMidiDataException
MidiMessage
into a string.m
- a MidiMessage
valueString
valueInvalidMidiDataException
Copyright © 2014. All Rights Reserved.