Class StringUtils

java.lang.Object
net.spy.memcached.util.StringUtils

public final class StringUtils extends Object
Utility methods on string objects.
  • Field Details

    • decimalPattern

      private static final 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:
    • KEY_TOO_LONG_EXCEPTION

      private static final IllegalArgumentException KEY_TOO_LONG_EXCEPTION
      Exception thrown if the input key is too long.
    • KEY_EMPTY_EXCEPTION

      private static final IllegalArgumentException 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

      public static String join(Collection<String> chunks, 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(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(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.