Package net.shibboleth.utilities.java.support.primitive

# Class StringSupport

java.lang.Object
net.shibboleth.utilities.java.support.primitive.StringSupport

@Deprecated(since="9.0.0", forRemoval=true) public final class StringSupport extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Legacy stub for `StringSupport`.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`StringSupport()`
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static Boolean`
`booleanOf(String what)`
Deprecated, for removal: This API element is subject to removal in a future version.
Null/empty preserving conversion from xs:boolean to `Boolean`.
`static String`
`inputStreamToString(InputStream input, CharsetDecoder decoder)`
Deprecated, for removal: This API element is subject to removal in a future version.
Reads an input stream into a string.
`static String`
`listToStringValue(List<?> values, String delimiter)`
Deprecated, for removal: This API element is subject to removal in a future version.
Converts a List of objects into a single string, with values separated by a specified delimiter.
`static Collection<String>`
`normalizeStringCollection(Collection<String> values)`
Deprecated, for removal: This API element is subject to removal in a future version.
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)`
Deprecated, for removal: This API element is subject to removal in a future version.
Converts a delimited string into a list.
`static String`
`trim(String s)`
Deprecated, for removal: This API element is subject to removal in a future version.
Safely trims a string.
`static String`
`trimOrNull(String s)`
Deprecated, for removal: This API element is subject to removal in a future version.
Safely trims a string and, if empty, converts it to null.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### StringSupport

private StringSupport()
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor.

## Method Details

### inputStreamToString

@Nonnull public static String inputStreamToString(@Nonnull InputStream input, @Nullable CharsetDecoder decoder) throws IOException
Deprecated, for removal: This API element is subject to removal in a future version.
Reads an input stream into a string. The provided stream is not closed.

Parameters:
  `input` - the input stream to read
  `decoder` - character decoder to use, if null, system default character set is used
Returns:
  the string read from the stream
Throws:
  `IOException` - thrown if there is a problem reading from the stream and decoding it

### listToStringValue

@Nonnull public static String listToStringValue(@Nonnull List<?> values, @Nonnull String delimiter)
Deprecated, for removal: This API element is subject to removal in a future version.
Converts a List of objects into a single string, with values separated by a specified delimiter.

Parameters:
  `values` - list of objects
  `delimiter` - the delimiter used between values
Returns:
  delimited string of values

### stringToList

@Nonnull public static List<String> stringToList(@Nonnull String string, @Nonnull String delimiter)
Deprecated, for removal: This API element is subject to removal in a future version.
Converts a delimited string into a list. We cannot use an ungarnished tokenizer since it doesn't add an empty String if the end of the input String was the delimiter. Hence we have to explicitly check.

Parameters:
  `string` - the string to be split into a list
  `delimiter` - the delimiter between values. This string may contain multiple delimiter characters, as allowed by `StringTokenizer`
Returns:
  the list of values or an empty list if the given string is empty

### trim

@Nullable public static String trim(@Nullable String s)
Deprecated, for removal: This API element is subject to removal in a future version.
Safely trims a string.

Parameters:
  `s` - the string to trim, may be null
Returns:
  the trimmed string or null if the given string was null

### trimOrNull

@Nullable public static String trimOrNull(@Nullable String s)
Deprecated, for removal: This API element is subject to removal in a future version.
Safely trims a string and, if empty, converts it to null.

Parameters:
  `s` - the string to trim, may be null
Returns:
  the trimmed string or null if the given string was null or the trimmed string was empty

### normalizeStringCollection

@Nonnull public static Collection<String> normalizeStringCollection(@Nullable @NullableElements Collection<String> values)
Deprecated, for removal: This API element is subject to removal in a future version.
Normalize a string collection by:

1. Safely trimming each member.
2. Converting all empty members to null.
3. Removing any null members.

Parameters:
  `values` - the collection of string values
Returns:
  the normalized collection of string values

### booleanOf

@Nullable public static Boolean booleanOf(String what)
Deprecated, for removal: This API element is subject to removal in a future version.
Null/empty preserving conversion from xs:boolean to `Boolean`.

Parameters:
  `what` - the string: potentially empty or null
Returns:
  null or the boolean equivalent.