Package net.spy.memcached.util
Class StringUtils
java.lang.Object
net.spy.memcached.util.StringUtils
Utility methods on string objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Pattern
A pattern to match on a signed integer value.private static final IllegalArgumentException
Exception thrown if the input key is empty.private static final IllegalArgumentException
Exception thrown if the input key is too long.private static final int
Maximum supported key length. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor, since this is a purely static class. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Check if a given string is a JSON object.static String
join
(Collection<String> chunks, String delimiter) Join a collection of strings together into one.static void
validateKey
(String key, boolean binary) Check if a given key is valid to transmit.
-
Field Details
-
decimalPattern
A pattern to match on a signed integer value. -
MAX_KEY_LENGTH
private static final int MAX_KEY_LENGTHMaximum supported key length.- See Also:
-
KEY_TOO_LONG_EXCEPTION
Exception thrown if the input key is too long. -
KEY_EMPTY_EXCEPTION
Exception thrown if the input key is empty.
-
-
Constructor Details
-
StringUtils
private StringUtils()Private constructor, since this is a purely static class.
-
-
Method Details
-
join
Join a collection of strings together into one.- Parameters:
chunks
- the chunks to join.delimiter
- the delimiter between the keys.- Returns:
- the fully joined string.
-
isJsonObject
Check if a given string is a JSON object.- Parameters:
s
- the input string.- Returns:
- true if it is a JSON object, false otherwise.
-
validateKey
Check if a given key is valid to transmit.- Parameters:
key
- the key to check.binary
- if binary protocol is used.
-