Java Hex Dump hexDump(String prompt, byte[] bs)

Here you can find the source of hexDump(String prompt, byte[] bs)

Description

hex Dump

License

Open Source License

Declaration

public static void hexDump(String prompt, byte[] bs) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedOutputStream;
import java.io.PrintStream;

public class Main {
    public static void hexDump(String prompt, byte[] bs) {
        PrintStream ps = new PrintStream(new BufferedOutputStream(System.out, 2048));

        ps.printf("%s:", prompt);

        for (byte b : bs)
            ps.printf("%02x ", b);
        ps.printf("[");
        for (byte b : bs)
            ps.printf("%c", Character.isLetterOrDigit(b) ? b : '.');
        ps.printf("]\n");

        ps.flush();/* w w  w . j a v a 2 s  .co  m*/
    }
}

Related

  1. hexdump(byte[] bytes, OutputStream out)
  2. hexDump(byte[] data)
  3. hexDump(InputStream is, OutputStream os)
  4. hexDump(InputStream is, PrintStream ps, int maxRead, int bytesPerLine)
  5. hexDump(PrintStream out, String s, byte b[], int n)
  6. hexDumpBytes(PrintStream out, long offset, byte[] bytes)