Class HexUtils


  • public class HexUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String bytesToHex​(byte[] bytes)
      Converts a byte array to a hex encoded (aka base 16 encoded) string
      static void decode​(java.lang.String hexEncodedString, int srcOffset, int srcLength, byte[] bytes, int destOffset)  
      static byte getNextByte​(java.lang.String hexEncodedString, int offset)  
      static void nextBytes​(java.lang.String hexEncodedString, int offset, byte[] bytes)  
      static void writeAsHex​(long l, com.dslplatform.json.JsonWriter jw)  
      static void writeByteAsHex​(byte b, java.lang.StringBuilder sb)  
      static void writeBytesAsHex​(byte[] bytes, int offset, int length, java.lang.StringBuilder sb)  
      static void writeBytesAsHex​(byte[] bytes, com.dslplatform.json.JsonWriter jw)  
      static void writeBytesAsHex​(byte[] bytes, java.lang.StringBuilder sb)  
      • Methods inherited from class java.lang.Object

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

      • bytesToHex

        public static java.lang.String bytesToHex​(byte[] bytes)
        Converts a byte array to a hex encoded (aka base 16 encoded) string

        From https://stackoverflow.com/a/9855338

        Parameters:
        bytes - The input byte array.
        Returns:
        A hex encoded string representation of the byte array.
      • writeBytesAsHex

        public static void writeBytesAsHex​(byte[] bytes,
                                           com.dslplatform.json.JsonWriter jw)
      • writeBytesAsHex

        public static void writeBytesAsHex​(byte[] bytes,
                                           java.lang.StringBuilder sb)
      • writeBytesAsHex

        public static void writeBytesAsHex​(byte[] bytes,
                                           int offset,
                                           int length,
                                           java.lang.StringBuilder sb)
      • writeByteAsHex

        public static void writeByteAsHex​(byte b,
                                          java.lang.StringBuilder sb)
      • getNextByte

        public static byte getNextByte​(java.lang.String hexEncodedString,
                                       int offset)
      • nextBytes

        public static void nextBytes​(java.lang.String hexEncodedString,
                                     int offset,
                                     byte[] bytes)
      • decode

        public static void decode​(java.lang.String hexEncodedString,
                                  int srcOffset,
                                  int srcLength,
                                  byte[] bytes,
                                  int destOffset)
      • writeAsHex

        public static void writeAsHex​(long l,
                                      com.dslplatform.json.JsonWriter jw)