|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opensaml.xml.util.DatatypeHelper
public final class DatatypeHelper
Helper class for working with various datatypes.
| Method Summary | ||
|---|---|---|
static byte[] |
fileToByteArray(java.io.File file)
Reads the contents of a file in to a byte array. |
|
static java.lang.String |
inputstreamToString(java.io.InputStream input,
java.nio.charset.CharsetDecoder decoder)
Reads an input stream into a string. |
|
static byte[] |
intToByteArray(int integer)
Converts an integer into an unsigned 4-byte array. |
|
static boolean |
isEmpty(java.lang.String s)
A "safe" null/empty check for strings. |
|
static java.lang.String |
listToStringValue(java.util.List<java.lang.String> values,
java.lang.String delimiter)
Converts a List of strings into a single string, with values separated by a specified delimiter. |
|
static
|
safeEquals(T s1,
T s2)
Compares two strings for equality, allowing for nulls. |
|
static java.lang.String |
safeTrim(java.lang.String s)
A safe string trim that handles nulls. |
|
static java.lang.String |
safeTrimOrNullString(java.lang.String s)
Removes preceeding or proceeding whitespace from a string or return null if the string is null or of zero length after trimming (i.e. |
|
static java.util.List<java.lang.String> |
stringToList(java.lang.String string,
java.lang.String delimiter)
Converts a delimited string into a list. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isEmpty(java.lang.String s)
s - The string to check
public static <T> boolean safeEquals(T s1,
T s2)
T - type of object to compares1 - The first operands2 - The second operand
public static java.lang.String safeTrim(java.lang.String s)
s - the string to trim
public static java.lang.String safeTrimOrNullString(java.lang.String s)
s - the string to trim
public static byte[] intToByteArray(int integer)
integer - integer to convert
public static byte[] fileToByteArray(java.io.File file)
throws java.io.IOException
file - file to read
java.io.IOException - throw if there is a problem reading the file in to the byte array
public static java.lang.String inputstreamToString(java.io.InputStream input,
java.nio.charset.CharsetDecoder decoder)
throws java.io.IOException
input - the input stream to readdecoder - character decoder to use, if null, system default character set is used
java.io.IOException - thrown if there is a problem reading from the stream and decoding it
public static java.util.List<java.lang.String> stringToList(java.lang.String string,
java.lang.String delimiter)
string - the string to be split into a listdelimiter - the delimiter between values. This string may contain
multiple delimiter characters, as allowed by
StringTokenizer
public static java.lang.String listToStringValue(java.util.List<java.lang.String> values,
java.lang.String delimiter)
values - list of stringsdelimiter - the delimiter used between values
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||