org.jclouds.util
Class Strings2

java.lang.Object
  extended by org.jclouds.util.Strings2

public class Strings2
extends Object


Constructor Summary
Strings2()
           
 
Method Summary
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 toString(com.google.common.io.InputSupplier<? extends InputStream> supplier)
          Deprecated. use CharSource.read() instead
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Strings2

public Strings2()
Method Detail

urlEncode

public static String urlEncode(String in,
                               char... skipEncode)
Web browsers do not always handle '+' characters well, use the well-supported '%20' instead.


urlEncode

public static String urlEncode(String in,
                               Iterable<Character> skipEncode)

isCidrFormat

public static boolean isCidrFormat(String in)

isUrlEncoded

public static boolean isUrlEncoded(String in)

urlDecode

public static String urlDecode(@Nullable
                               String in)
url decodes the input param, if set.

Parameters:
in - nullable
Returns:
null if input was null
Throws:
IllegalStateException - if encoding isn't UTF-8

toString

@Deprecated
public static String toString(com.google.common.io.InputSupplier<? extends InputStream> supplier)
                       throws IOException
Deprecated. use CharSource.read() instead

Throws:
IOException

toStringAndClose

public static String toStringAndClose(InputStream input)
                               throws IOException
Throws:
IOException

toInputStream

public static InputStream toInputStream(String in)

replaceTokens

public static String replaceTokens(String input,
                                   Map<String,String> replacements)
replaces tokens that are expressed as {token}

ex. if input is "hello {where}"
and replacements is "where" -> "world"
then replaceTokens returns "hello world"

Parameters:
input - source to replace
replacements - token/value pairs

replaceTokens

public static String replaceTokens(String input,
                                   com.google.common.collect.Multimap<String,?> tokenValues)


Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.