List of utility methods to do Byte Array Dump
String | dumpBytes(byte bb[]) Dump byte array as hex string. StringBuffer result = new StringBuffer(bb.length * 4); String ss; int c = 8; int lineCount = bb.length / c; int t = bb.length % c; if (t != 0) { lineCount++; for (int i = 0; i < lineCount; i++) { result.append(i * c + "\t:"); int tt = c; if (t != 0 && i == lineCount - 1) { tt = t; char cc[] = new char[tt]; for (int j = 0; j < tt; j++) { ss = "0" + Integer.toHexString(bb[i * c + j]); result.append(ss.substring(ss.length() - 2) + ","); cc[j] = (char) bb[i * c + j]; for (int k = 0; k < c - tt; k++) { result.append("--,"); result.append("\t:"); result.append(cc); result.append("\n"); return result.toString(); |
String | dumpBytes(byte[] a) dump Bytes StringBuilder sb = new StringBuilder(a.length * 2); for (byte b : a) sb.append(String.format("%x", b & 0xff)); return sb.toString(); |
void | dumpBytes(byte[] b) dump Bytes for (int i = 0; i < b.length; ++i) { if (i % 16 == 0) System.err.println(""); String hex = "0" + Integer.toHexString(b[i]); hex = hex.substring(hex.length() - 2); System.err.print(hex + " "); System.err.println("\n"); ... |
String | dumpBytes(byte[] buffer) Helper function that dump an array of bytes in hex form if (buffer == null) { return ""; StringBuilder sb = new StringBuilder(2 + buffer.length * 2); for (byte b : buffer) { sb.append("0x").append((char) (HEX_CHAR[(b & 0x00F0) >> 4])).append((char) (HEX_CHAR[b & 0x000F])) .append(" "); return sb.toString(); |
String | dumpBytes(byte[] buffer) Get the text representation of the specified byte array. return dumpBytes(buffer, 0, buffer.length);
|
String | dumpBytes(byte[] bytes) Returns heksadesimaalit tavutaulukosta merkkijonona. int size = bytes.length; StringBuffer sb = new StringBuffer(size * 2); String s; for (int i = 0; i < size; ++i) { s = Integer.toHexString(bytes[i]); if (s.length() == 8) { sb.append(s.substring(6)); } else if (s.length() == 2) { ... |
String | dumpBytes(byte[] bytes) dump Bytes char[] hexChars = new char[bytes.length * 2]; for (int i = 0; i < bytes.length; i++) { int val = bytes[i] & 0xFF; hexChars[i * 2] = hexArray[val >>> 4]; hexChars[i * 2 + 1] = hexArray[val & 0x0F]; return new String(hexChars); |
String | dumpBytes(byte[] bytes) dump Bytes StringBuffer sb = new StringBuffer(); for (int i = 0; i < bytes.length; i++) { int unsignedInt = 0xFF & bytes[i]; if (unsignedInt < 0x10) { sb.append("0"); sb.append(Integer.toHexString(unsignedInt)); return sb.toString(); |
void | dumpBytes(byte[] bytes, int maxLen) dump Bytes for (int i = 0, max = Math.min(maxLen, bytes.length); i < max; i++) { System.err.print(" "); System.err.print(Integer.toHexString(bytes[i] & 0xff)); System.err.println(); |
String | dumpBytes(byte[] bytes, int start, int length) Convert a part of an array of bytes, into a string of space-separated hexadecimal numbers. This method is proposed as a convenience for debugging purposes. StringBuilder sb = new StringBuilder(); if (length >= 0) { for (int i = start; i < Math.min(bytes.length, start + length); i++) { if (i > start) sb.append(' '); sb.append(toHexString(bytes[i])); return sb.toString(); |