Class Hexdump


  • public final class Hexdump
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static char[] HEX_CHARS  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Hexdump()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String format​(byte[] _buf)  
      static java.lang.String format​(byte[] _buf, int _width)  
      static void print​(byte[] _buf)  
      static void print​(byte[] _buf, int _width)  
      static void print​(byte[] _buf, int _width, java.io.PrintStream _out)  
      static void print​(byte[] _buf, java.io.PrintStream _out)  
      static java.lang.String toAscii​(byte[] _buf)  
      static java.lang.String toAscii​(byte[] _buf, int _ofs, int _len)  
      static java.lang.String toByteArray​(byte[] _buf)
      Returns a string which can be written to a Java source file as part of a static initializer for a byte array.
      static java.lang.String toByteArray​(byte[] _buf, int _ofs, int _len)
      Returns a string which can be written to a Java source file as part of a static initializer for a byte array.
      static java.lang.String toHex​(byte[] _buf)  
      static java.lang.String toHex​(byte[] _buf, boolean _spaces)  
      static java.lang.String toHex​(byte[] _buf, int _ofs, int _len, boolean _spaces)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HEX_CHARS

        public static final char[] HEX_CHARS
    • Constructor Detail

      • Hexdump

        private Hexdump()
    • Method Detail

      • toHex

        public static java.lang.String toHex​(byte[] _buf)
      • toHex

        public static java.lang.String toHex​(byte[] _buf,
                                             boolean _spaces)
      • toHex

        public static java.lang.String toHex​(byte[] _buf,
                                             int _ofs,
                                             int _len,
                                             boolean _spaces)
      • toAscii

        public static java.lang.String toAscii​(byte[] _buf)
      • toAscii

        public static java.lang.String toAscii​(byte[] _buf,
                                               int _ofs,
                                               int _len)
      • format

        public static java.lang.String format​(byte[] _buf)
      • format

        public static java.lang.String format​(byte[] _buf,
                                              int _width)
      • print

        public static void print​(byte[] _buf)
      • print

        public static void print​(byte[] _buf,
                                 int _width)
      • print

        public static void print​(byte[] _buf,
                                 int _width,
                                 java.io.PrintStream _out)
      • print

        public static void print​(byte[] _buf,
                                 java.io.PrintStream _out)
      • toByteArray

        public static java.lang.String toByteArray​(byte[] _buf)
        Returns a string which can be written to a Java source file as part of a static initializer for a byte array. Returns data in the format 0xAB, 0xCD, .... use like: javafile.print("byte[] data = {") javafile.print(Hexdump.toByteArray(data)); javafile.println("};"); * @param buf
        Parameters:
        _buf - buffer
        Returns:
        string
      • toByteArray

        public static java.lang.String toByteArray​(byte[] _buf,
                                                   int _ofs,
                                                   int _len)
        Returns a string which can be written to a Java source file as part of a static initializer for a byte array. Returns data in the format 0xAB, 0xCD, .... use like: javafile.print("byte[] data = {") javafile.print(Hexdump.toByteArray(data)); javafile.println("};");
        Parameters:
        _buf - buffer
        _ofs - offset
        _len - length
        Returns:
        string