Package net.spy.memcached.util
Class StringUtils
- java.lang.Object
-
- net.spy.memcached.util.StringUtils
-
public final class StringUtils extends java.lang.ObjectUtility methods on string objects.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.PatterndecimalPatternA pattern to match on a signed integer value.private static java.lang.IllegalArgumentExceptionKEY_EMPTY_EXCEPTIONException thrown if the input key is empty.private static java.lang.IllegalArgumentExceptionKEY_TOO_LONG_EXCEPTIONException thrown if the input key is too long.private static intMAX_KEY_LENGTHMaximum supported key length.
-
Constructor Summary
Constructors Modifier Constructor Description privateStringUtils()Private constructor, since this is a purely static class.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisJsonObject(java.lang.String s)Check if a given string is a JSON object.static java.lang.Stringjoin(java.util.Collection<java.lang.String> chunks, java.lang.String delimiter)Join a collection of strings together into one.static voidvalidateKey(java.lang.String key, boolean binary)Check if a given key is valid to transmit.
-
-
-
Field Detail
-
decimalPattern
private static final java.util.regex.Pattern decimalPattern
A pattern to match on a signed integer value.
-
MAX_KEY_LENGTH
private static final int MAX_KEY_LENGTH
Maximum supported key length.- See Also:
- Constant Field Values
-
KEY_TOO_LONG_EXCEPTION
private static final java.lang.IllegalArgumentException KEY_TOO_LONG_EXCEPTION
Exception thrown if the input key is too long.
-
KEY_EMPTY_EXCEPTION
private static final java.lang.IllegalArgumentException KEY_EMPTY_EXCEPTION
Exception thrown if the input key is empty.
-
-
Method Detail
-
join
public static java.lang.String join(java.util.Collection<java.lang.String> chunks, java.lang.String delimiter)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
public static boolean isJsonObject(java.lang.String s)
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
public static void validateKey(java.lang.String key, boolean binary)Check if a given key is valid to transmit.- Parameters:
key- the key to check.binary- if binary protocol is used.
-
-