Package aQute.lib.hex

Class Hex

java.lang.Object
aQute.lib.hex.Hex

public class Hex extends Object
  • Field Details

    • HEX_P

      private static final Pattern HEX_P
    • HEX

      static final char[] HEX
  • Constructor Details

    • Hex

      public Hex()
  • Method Details

    • toByteArray

      public static final byte[] toByteArray(String string)
    • toHex

      public static String toHex(byte b)
    • nibble

      public static final int nibble(char c)
    • toHexString

      public static final String toHexString(byte[] data)
    • append

      public static final void append(Appendable sb, byte[] data) throws IOException
      Throws:
      IOException
    • nibble

      public static final char nibble(int i)
    • isHex

      public static boolean isHex(String pub)
    • isHexCharacter

      public static boolean isHexCharacter(char c)
    • separated

      public static String separated(byte[] bytes, String separator)
    • separated

      public static String separated(byte[] bytes, int start, int length, String separator)
    • format

      public static String format(byte[] data)
      Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.
      Parameters:
      data - the buffer
      Returns:
      a String with the formatted data
    • format

      public static String format(ByteBuffer data)
      Format a buffer to show the buffer in a table with 16 bytes per row, hex values and ascii values are shown.
      Parameters:
      data - the buffer
      Returns:
      a String with the formatted data
    • isBinary

      public static boolean isBinary(byte[] data)
      Check of a buffer is classified as binary or text. We assume a file is binary of it contains a 0 byte. Heuristics may differ in the future, this method is really to collect this decision in one place.
      Parameters:
      data - the buffer
      Returns:
      true of classified as binary
    • isBinary

      public static boolean isBinary(ByteBuffer data)
      Check of a buffer is classified as binary or text. We assume a file is binary of it contains a 0 byte. Heuristics may differ in the future, this method is really to collect this decision in one place.
      Parameters:
      data - the buffer
      Returns:
      true of classified as binary
    • append

      public static void append(Appendable sb, byte ch)
    • append

      public static void append(Appendable sb, short ch)
    • append

      public static void append(Appendable sb, char ch)
    • append

      public static void append(Appendable sb, int ch)
    • append

      public static void append(Appendable sb, long ch)