public class Strings2 extends Object
Constructor and Description |
---|
Strings2() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isCidrFormat(String in) |
static boolean |
isUrlEncoded(String in) |
static String |
replaceTokens(String input,
Map<String,String> replacements)
replaces tokens that are expressed as
{token}
ex. |
static String |
replaceTokens(String input,
com.google.common.collect.Multimap<String,?> tokenValues) |
static InputStream |
toInputStream(String in) |
static String |
toStringAndClose(InputStream input) |
static String |
urlDecode(String in)
url decodes the input param, if set.
|
static String |
urlEncode(String in,
char... skipEncode)
Web browsers do not always handle '+' characters well, use the well-supported '%20' instead.
|
static String |
urlEncode(String in,
Iterable<Character> skipEncode) |
public static String urlEncode(String in, char... skipEncode)
public static boolean isCidrFormat(String in)
public static boolean isUrlEncoded(String in)
public static String urlDecode(@Nullable String in)
in
- nullableIllegalStateException
- if encoding isn't UTF-8
public static String toStringAndClose(InputStream input) throws IOException
IOException
public static InputStream toInputStream(String in)
public static String replaceTokens(String input, Map<String,String> replacements)
{token}
ex. if input is "hello {where}"input
- source to replacereplacements
- token/value pairsCopyright © 2009-2016 The Apache Software Foundation. All Rights Reserved.