Class base16

java.lang.Object
org.xbill.DNS.utils.base16

public class base16 extends Object
Routines for converting between Strings of hex-encoded data and arrays of binary data. This is not actually used by DNS.
Author:
Brian Wellington
  • Method Details

    • toString

      public static String toString(byte[] b)
      Convert binary data to a hex-encoded String
      Parameters:
      b - An array containing binary data
      Returns:
      A String containing the encoded data
    • toString

      public static String toString(byte[] b, int lineLength, String prefix, boolean addClose)
      Convert binary data to a hex-encoded string, line-wrapped at lineLength characters.
      Parameters:
      b - An array containing binary data
      lineLength - The number of characters per line
      prefix - A string prefixing the characters on each line
      addClose - Whether to add a close parenthesis or not
      Returns:
      A String containing the encoded data
      Since:
      3.6
    • fromString

      public static byte[] fromString(String str)
      Convert a hex-encoded String to binary data, ignoring whitespace characters.

      Returns null

      • when str is null,
      • when non-hex digits or non-whitespace characters are encountered.
      Parameters:
      str - A String containing the encoded data.
      Returns:
      An array containing the binary data, or null if the string is invalid.