Class Strings

java.lang.Object
org.apache.hadoop.hbase.util.Strings

@Private public final class Strings extends Object
Utility for Strings.
  • Field Details

  • Constructor Details

  • Method Details

    • appendKeyValue

      public static StringBuilder appendKeyValue(StringBuilder sb, String key, Object value)
      Append to a StringBuilder a key/value. Uses default separators.
      Parameters:
      sb - StringBuilder to use
      key - Key to append.
      value - Value to append.
      Returns:
      Passed sb populated with key/value.
    • appendKeyValue

      public static StringBuilder appendKeyValue(StringBuilder sb, String key, Object value, String separator, String keyValueSeparator)
      Append to a StringBuilder a key/value. Uses default separators.
      Parameters:
      sb - StringBuilder to use
      key - Key to append.
      value - Value to append.
      separator - Value to use between key and value.
      keyValueSeparator - Value to use between key/value sets.
      Returns:
      Passed sb populated with key/value.
    • domainNamePointerToHostName

      public static String domainNamePointerToHostName(String dnPtr)
      Given a PTR string generated via reverse DNS lookup, return everything except the trailing period. Example for host.example.com., return host.example.com
      Parameters:
      dnPtr - a domain name pointer (PTR) string.
      Returns:
      Sanitized hostname with last period stripped off.
    • padFront

      public static String padFront(String input, char padding, int length)
      Push the input string to the right by appending a character before it, usually a space.
      Parameters:
      input - the string to pad
      padding - the character to repeat to the left of the input string
      length - the desired total length including the padding
      Returns:
      padding characters + input