Class StringUtil

java.lang.Object
com.dropbox.core.util.StringUtil

public class StringUtil extends Object
  • Field Details

  • Constructor Details

    • StringUtil

      public StringUtil()
  • Method Details

    • hexDigit

      public static char hexDigit(int i)
    • utf8ToString

      public static String utf8ToString(byte[] utf8Data) throws CharacterCodingException
      Throws:
      CharacterCodingException
    • utf8ToString

      public static String utf8ToString(byte[] utf8Data, int offset, int length) throws CharacterCodingException
      Throws:
      CharacterCodingException
    • stringToUtf8

      public static byte[] stringToUtf8(String s)
    • javaQuotedLiteral

      public static String javaQuotedLiteral(String value)
      Given a string, returns the representation of that string as a Java string literal.
    • javaQuotedLiterals

      public static String javaQuotedLiterals(String[] value)
    • javaQuotedLiterals

      public static String javaQuotedLiterals(Iterable<String> value)
    • jq

      public static String jq(String value)
    • jq

      public static String jq(String[] value)
    • jq

      public static String jq(Iterable<String> value)
    • binaryToHex

      public static String binaryToHex(byte[] data)
    • binaryToHex

      public static String binaryToHex(byte[] data, int offset, int length)
      Convert a string of binary bytes to the equivalent hexadecimal string. The resulting String will have two characters for every byte in the input.
    • secureStringEquals

      public static boolean secureStringEquals(String a, String b)
      When you're comparing two strings for equality and one of them is a value that could be provided by an attacker and the other is a value that the attacker shouldn't know, use this function to check for equality. Using regular String.equals is not secure.
    • base64Encode

      public static String base64Encode(byte[] data)
    • urlSafeBase64Encode

      public static String urlSafeBase64Encode(byte[] data)
    • base64EncodeGeneric

      public static String base64EncodeGeneric(String digits, byte[] data)
    • join

      public static String join(Collection<String> strings, String delimiter)