Class StringUtils
java.lang.Object
net.spy.memcached.util.StringUtils
Utility methods on string objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final PatternA pattern to match on a signed integer value.private static final IllegalArgumentExceptionException thrown if the input key is empty.private static final IllegalArgumentExceptionException thrown if the input key is too long.private static final intMaximum supported key length. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor, since this is a purely static class. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCheck if a given string is a JSON object.static Stringjoin(Collection<String> chunks, String delimiter) Join a collection of strings together into one.static voidvalidateKey(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.
-