@InterfaceAudience.Private public class Strings extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_KEYVALUE_SEPARATOR |
static String |
DEFAULT_SEPARATOR |
Constructor and Description |
---|
Strings() |
Modifier and Type | Method and Description |
---|---|
static StringBuilder |
appendKeyValue(StringBuilder sb,
String key,
Object value)
Append to a StringBuilder a key/value.
|
static StringBuilder |
appendKeyValue(StringBuilder sb,
String key,
Object value,
String separator,
String keyValueSeparator)
Append to a StringBuilder a key/value.
|
static String |
domainNamePointerToHostName(String dnPtr)
Given a PTR string generated via reverse DNS lookup, return everything
except the trailing period.
|
static boolean |
isEmpty(String input)
Null-safe length check.
|
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.
|
static String |
repeat(char c,
int reapeatFor) |
public static final String DEFAULT_SEPARATOR
public static final String DEFAULT_KEYVALUE_SEPARATOR
public static StringBuilder appendKeyValue(StringBuilder sb, String key, Object value)
sb
- StringBuilder to usekey
- Key to append.value
- Value to append.sb
populated with key/value.public static StringBuilder appendKeyValue(StringBuilder sb, String key, Object value, String separator, String keyValueSeparator)
sb
- StringBuilder to usekey
- Key to append.value
- Value to append.separator
- Value to use between key and value.keyValueSeparator
- Value to use between key/value sets.sb
populated with key/value.public static String domainNamePointerToHostName(String dnPtr)
dnPtr
- a domain name pointer (PTR) string.public static boolean isEmpty(String input)
input
- public static String padFront(String input, char padding, int length)
input
- the string to padpadding
- the character to repeat to the left of the input stringlength
- the desired total length including the paddingpublic static String repeat(char c, int reapeatFor)
c
- repeat this characterreapeatFor
- the length of the output String