|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.lambico.test.spring.Utils
public class Utils
Some utility methods.
| Constructor Summary | |
|---|---|
protected |
Utils()
A default protected constructor. |
| Method Summary | |
|---|---|
static java.util.List<java.lang.String> |
convertToNameValueList(java.util.Map map)
Converts a map in a list of name/value pairs. |
static java.util.List<java.lang.String> |
convertToNameValueList(java.util.Map map,
boolean urlEncode)
Converts a map in a list of name/value pairs. |
static boolean |
hasUTF8preamble(byte[] b)
Checks if the array starts with the UTF-8 preamble. |
static boolean |
hasUTF8preamble(java.lang.String s)
Checks if the string starts with the UTF-8 preamble. |
static byte[] |
loadBinary(org.springframework.core.io.Resource classpathResource)
Loads a binary file from the classpath. |
static byte[] |
loadBinary(java.lang.String classpathResource)
Loads a binary file from the classpath. |
static java.lang.String |
loadString(org.springframework.core.io.Resource classpathResource)
Loads a text file from the classpath. |
static java.lang.String |
loadString(java.lang.String classpathResource)
Loads a text file from the classpath. |
static byte[] |
stripUTF8preamble(byte[] b)
Strips the UTF8 preamble, if present. |
static java.lang.String |
stripUTF8preamble(java.lang.String s)
Strips the UTF8 preamble, if present. |
static java.lang.String[] |
uncamelize(java.lang.String camelString)
Return an array containing all the substrings of camelString, according to this rule: divide camelString
into tokens with every token starting from a capital letter to another. |
protected static byte[] |
unsafeLoadBinary(java.io.InputStream stream)
Loads a binary file from a stream. |
protected static java.lang.String |
unsafeLoadString(java.io.InputStream stream)
Loads a text file from a stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Utils()
| Method Detail |
|---|
public static java.util.List<java.lang.String> convertToNameValueList(java.util.Map map)
map - The map.
public static java.util.List<java.lang.String> convertToNameValueList(java.util.Map map,
boolean urlEncode)
map - The map.urlEncode - if true, encode the values as URLs.
public static byte[] loadBinary(java.lang.String classpathResource)
classpathResource - The resource path.
public static byte[] loadBinary(org.springframework.core.io.Resource classpathResource)
classpathResource - The resource path.
protected static byte[] unsafeLoadBinary(java.io.InputStream stream)
throws java.io.IOException
stream - The stream from where to load. It is open,
and it won't be closed by this method.
java.io.IOException - In case of error.public static java.lang.String loadString(java.lang.String classpathResource)
classpathResource - The resource path.
public static java.lang.String loadString(org.springframework.core.io.Resource classpathResource)
classpathResource - The resource path.
protected static java.lang.String unsafeLoadString(java.io.InputStream stream)
throws java.io.IOException
stream - The stream from where to load. It is open,
and it won't be closed by this method.
java.io.IOException - In case of error.
public static java.lang.String stripUTF8preamble(java.lang.String s)
throws java.io.UnsupportedEncodingException
new String(UTF8_PREAMBLE).getBytes() != UTF8_PREAMBLE;
Here
an explanation.
s - The string to strip.
java.io.UnsupportedEncodingException - If the UTF-8 encoding is not supported.public static byte[] stripUTF8preamble(byte[] b)
b - The array of bytes (characters).
public static boolean hasUTF8preamble(byte[] b)
b - The array to inspect.
public static boolean hasUTF8preamble(java.lang.String s)
s - The string to inspect.
public static java.lang.String[] uncamelize(java.lang.String camelString)
camelString, according to this rule: divide camelString
into tokens with every token starting from a capital letter to another.
Some examples:
camelString - The string to uncamelize.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||