List of utility methods to do Dump Byte Array
void | dump(byte[] buffer, int start, int size, PrintStream out) Prints hex dump of part of byte array to specified stream StringBuffer sb = new StringBuffer(); int pos = 0; for (int i = 0; i < size / 16; i++) { _dump(buffer, start + pos, 16, out); pos += 16; out.println(); _dump(buffer, start + pos, size - pos, out); ... |
void | dump(byte[] data, OutputStream out, boolean closeOutput) Dump all data in buffer to output stream. try { out.write(data, 0, data.length); } finally { if (closeOutput) { out.close(); |
void | dump(final byte[] b, final PrintStream out) dump for (int i = 0; i < b.length; ++i) { if (i % 16 == 0) { out.print(Integer.toHexString(i & 0xFFFF | 0x10000).substring(1, 5) + " - "); out.print(Integer.toHexString(b[i] & 0xFF | 0x100).substring(1, 3) + ' '); if (i % 16 == 15 || i == b.length - 1) { int j; for (j = 16 - i % 16; j > 1; --j) { ... |
void | dump(PrintStream printer, byte[] buffer, int offset, int count) Dumps a buffer in printable form. if (count == 0) { return; final int upper_bound = offset + (count / 8 + 1) * 8; int i = offset; StringBuffer str = new StringBuffer(); while (i <= upper_bound) { int j; ... |
void | dumpBuffer(final PrintStream out, final String label, final byte[] b) dump Buffer dumpBuffer(out, label, b, 0, b.length); |
String | dumpByteArray(byte[] byteArray) creates a nice hex-dump of the byte array if (byteArray == null) { return "null"; return dumpInputStream(new ByteArrayInputStream(byteArray)); |
String | dumpByteArray(byte[] bytes) dump Byte Array StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { byte b = bytes[i]; int iVal = b & 0xFF; int byteN = Integer.parseInt(Integer.toBinaryString(iVal)); sb.append(String.format("%1$02d: %2$08d %3$1c %3$d\n", i, byteN, iVal)); return sb.toString(); ... |
void | dumpBytes(PrintStream printStream, byte bytes[]) dump Bytes for (int i = 0; i < bytes.length; i++) { if (i % 16 == 0) printStream.printf("%1$06X:", i); printStream.print(' '); if (bytes[i] < 32 || bytes[i] >= 127) printStream.print(' '); else printStream.print((char) bytes[i]); ... |
void | dumpBytesAsString(ByteArrayOutputStream baos) dump Bytes As String byte b[] = baos.toByteArray(); for (byte i : b) { System.out.print((char) i); System.out.println(); |
void | dumpBytesToFile(byte[] bytes, String outputFile) dump Bytes To File try { BufferedWriter bw = new BufferedWriter(new FileWriter(outputFile)); for (int i = 0; i < bytes.length; ++i) { bw.write(getByteAsAscii(bytes[i])); if ((i + 1) % 16 == 0) { bw.write("\n"); bw.close(); } catch (IOException e) { e.printStackTrace(); |