List of utility methods to do Byte Array Dump
void | dump(byte[] rec) dump for (int i = 0; i < rec.length; i++) { String s = String.format("%02x", (0xFF & rec[i])); System.out.print("0x" + s + " "); if (((i + 1) % 16) == 0) System.out.println(); System.out.println(); |
String | dump(byte[] str) dump if (str == null) return null; StringBuilder data = new StringBuilder(); for (byte b : str) { String hex = Integer.toHexString((int) b); data.append(hex); return data.toString(); ... |
String | dumpArray(byte b[]) dump Array return dumpArray(b, 0, b.length);
|
String | dumpArray(byte[] b) dump Array StringBuilder sb = new StringBuilder("byte[" + b.length + "]={"); for (int i = 0; i < b.length; i++) { if (i > 0) sb.append(","); sb.append("0x"); if ((b[i] & 0xF0) == 0) sb.append("0"); sb.append(Integer.toHexString(b[i] & 0xFF).toUpperCase()); ... |
String | dumpArray(byte[] buffer, boolean breakLines) Return the array as a printable string. StringBuilder sb = new StringBuilder(); boolean lastOneIsR = false; for (byte b : buffer) { if (b >= 32 && b <= 126) sb.append(new String(new byte[] { b })); else if (b == 10) { sb.append("\\n"); if (lastOneIsR) { ... |
void | dumpByteArray(byte[] ab) dump Byte Array for (int i = 0; i < ab.length; i++) { System.out.print(" " + ab[i]); System.out.println(""); |
String | dumpByteArray(byte[] b) dump Byte Array StringBuilder sb = new StringBuilder(); sb.append("<byteArray len = "); sb.append(b.length); sb.append(" data = \""); for (int i = 0; i < b.length; i++) { sb.append(b[i]).append(","); sb.append("\"/>"); ... |
String | dumpByteArray(byte[] buffer) dump Byte Array StringBuffer sb = new StringBuffer(); sb.append("{ "); int len = buffer.length; for (int i = 0; i < len; i++) { if (i > 0) sb.append(", "); sb.append(buffer[i] & 0xff); sb.append(" }"); return sb.toString(); |
void | dumpByteArray(byte[] bytes) dump Byte Array int count = 0; StringBuilder stringBuilder = new StringBuilder(); for (byte aByte : bytes) { String hex = Integer.toHexString(aByte & 255); if (hex.length() == 1) { hex = "0" + hex; stringBuilder.append(hex).append(" "); ... |
String | dumpByteArrayAsInts(byte[] arr) Dumps the content of a byte array as a sequence of integers StringBuilder buf = new StringBuilder(""); for (int i = 0; i < arr.length; i++) { buf.append(arr[i]); if (i != (arr.length - 1)) { buf.append(" "); return buf.toString(); ... |