Package org.apache.hadoop.hbase.util
Class Strings
java.lang.Object
org.apache.hadoop.hbase.util.Strings
Utility for Strings.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 void
applyURIQueriesToConf
(URI uri, org.apache.hadoop.conf.Configuration conf) Apply the key value pairs in the query string of the given URI to the given Configuration.static String
Given a PTR string generated via reverse DNS lookup, return everything except the trailing period.static String
Push the input string to the right by appending a character before it, usually a space.parseURIQueries
(URI uri) Parse the query string of an URI to a key value map.
-
Field Details
-
DEFAULT_SEPARATOR
- See Also:
-
DEFAULT_KEYVALUE_SEPARATOR
- See Also:
-
JOINER
-
SPLITTER
-
-
Constructor Details
-
Strings
private Strings()
-
-
Method Details
-
appendKeyValue
Append to a StringBuilder a key/value. Uses default separators.- Parameters:
sb
- StringBuilder to usekey
- 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 usekey
- 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
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
Push the input string to the right by appending a character before it, usually a space.- Parameters:
input
- the string to padpadding
- the character to repeat to the left of the input stringlength
- the desired total length including the padding- Returns:
- padding characters + input
-
parseURIQueries
Parse the query string of an URI to a key value map. If a single key occurred multiple times, only the first one will take effect. -
applyURIQueriesToConf
Apply the key value pairs in the query string of the given URI to the given Configuration. If a single key occurred multiple times, only the first one will take effect.
-