List of utility methods to do Dump Byte Array
void | dumpClass(String file, byte[] bytes) Dump some bytes into the specified file. File f = new File(file); try { FileOutputStream fos = new FileOutputStream(f); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); ... |
byte[] | dumpFileIntoByteArray(File f) dump File Into Byte Array ByteArrayOutputStream byteStream = null; BufferedInputStream fileStream = null; try { byteStream = new ByteArrayOutputStream(); fileStream = new BufferedInputStream(new FileInputStream(f)); int data = -1; while ((data = fileStream.read()) != -1) { byteStream.write(data); ... |
String | dumpHex(byte[] data) Dump an the content of an array of byte as a hex dump StringBuffer result = new StringBuffer(); ByteArrayInputStream buf = new ByteArrayInputStream(data); int lineBytes = 0; int i; byte[] b = new byte[16]; String s; while (buf.available() > 0) { b[lineBytes] = (byte) buf.read(); ... |
void | dumpHex(PrintStream out, byte[] data, int offset, int length) Dumps an array of byte to the output string as a sequence of hexadecimal digits. if ((offset + length) > data.length) return; int cnt = 0; while (length > 0) { byte b = data[offset]; out.print("0x"); out.print(Integer.toHexString((b >> 4) & 0xf)); out.print(Integer.toHexString(b & 0xf)); ... |
String | dumpHex(String _string, String _encoding) dump Hex StringBuilder sb = new StringBuilder(); byte[] bytes = _string.getBytes(_encoding); for (int i = 0; i < bytes.length; i++) { sb.append(Integer.toHexString(bytes[i] & 0xff)); if (i < bytes.length - 1) { sb.append(" "); return sb.toString(); |
String | dumpHex(String value, String encoding) dump Hex StringBuilder sb = new StringBuilder(); byte[] bytes = value.getBytes(encoding); for (int i = 0; i < bytes.length; i++) { sb.append(Integer.toHexString(bytes[i] & 255)); if (i < bytes.length - 1) { sb.append(' '); return sb.toString(); |