Last active
December 19, 2015 01:39
-
-
Save soapplied/5877180 to your computer and use it in GitHub Desktop.
SIBQueuedMessage getMessageContents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte[] msgContents = (byte[]) server.invoke(obj, "getMessageData", | |
new Object[] { msg.getId(), new Integer(0x19000) }, new String[] { | |
"java.lang.String", "java.lang.Integer" }); | |
StringBuffer sb = new StringBuffer(); | |
sb.append("Contents of Message ").append(msg.getId()).append(":\r\n\r\n"); | |
if (msgContents != null) { | |
int dataLength = msgContents.length; | |
sb.append("Data length = 0x").append( | |
Integer.toHexString(dataLength)).append(" (").append( | |
dataLength).append(") bytes\r\n\r\n"); | |
sb | |
.append(" : 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 2 4 6 8 A C E "+ | |
"\r\n"); | |
String cur[] = new String[16]; | |
String str[] = new String[16]; | |
for (int j = 0; j < 16; j++) { | |
cur[j] = null; | |
str[j] = null; | |
} | |
for (int x = 0; x < dataLength; x += 16) { | |
for (int y = 0; y < 16; y++) { | |
int t = x + y; | |
if (t < dataLength) { | |
cur[y] = pad(Integer.toHexString(msgContents[t]), 2, | |
null); | |
if (msgContents[t] < 32) | |
str[y] = "."; | |
else | |
str[y] = new String(msgContents, t, 1); | |
} else { | |
cur[y] = " "; | |
str[y] = "."; | |
} | |
} | |
sb.append("0x" + pad(Integer.toHexString(x), 8, null) + " (" | |
+ pad((new Integer(x)).toString(), 8, " ") + ") : "); | |
sb.append(cur[0] + cur[1] + cur[2] + cur[3] + " " + cur[4] | |
+ cur[5] + cur[6] + cur[7] + " " + cur[8] + cur[9] | |
+ cur[10] + cur[11] + " " + cur[12] + cur[13] + cur[14] | |
+ cur[15]); | |
sb.append(" | "); | |
sb.append(str[0] + str[1] + str[2] + str[3] + str[4] + str[5] | |
+ str[6] + str[7] + str[8] + str[9] + str[10] + str[11] | |
+ str[12] + str[13] + str[14] + str[15]); | |
sb.append("\r\n"); | |
} | |
} | |
System.out.println(sb.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment