public final class StringSupport extends Object
Modifier | Constructor and Description |
---|---|
private |
StringSupport()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static String |
inputStreamToString(InputStream input,
CharsetDecoder decoder)
Reads an input stream into a string.
|
static String |
listToStringValue(List<?> values,
String delimiter)
Converts a List of objects into a single string, with values separated by a specified delimiter.
|
static Collection<String> |
normalizeStringCollection(Collection<String> values)
Normalize a string collection by:
Safely trimming each member.
Converting all empty members to null.
Removing any null members.
|
static List<String> |
stringToList(String string,
String delimiter)
Converts a delimited string into a list.
|
static String |
trim(String s)
Safely trims a string.
|
static String |
trimOrNull(String s)
Safely trims a string and, if empty, converts it to null.
|
@Nonnull public static String inputStreamToString(@Nonnull InputStream input, @Nullable CharsetDecoder decoder) throws IOException
input
- the input stream to readdecoder
- character decoder to use, if null, system default character set is usedIOException
- thrown if there is a problem reading from the stream and decoding it@Nonnull public static String listToStringValue(@Nonnull List<?> values, @Nonnull String delimiter)
values
- list of objectsdelimiter
- the delimiter used between values@Nonnull public static List<String> stringToList(@Nonnull String string, @Nonnull 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
@Nullable public static String trim(@Nullable String s)
s
- the string to trim, may be null@Nullable public static String trimOrNull(@Nullable String s)
s
- the string to trim, may be null@Nonnull @NonnullElements public static Collection<String> normalizeStringCollection(@Nullable @NullableElements Collection<String> values)
values
- the collection of string valuesCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.