public final class StringUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
asString(InputStream is,
Charset charset)
Reads the provided input stream as a string and then closes the stream.
|
static String |
join(String separator,
Iterable<?> elements)
Joins a collection of elements into a single string value, with a specified separator.
|
static String |
join(String separator,
Object... elements)
Joins an array of strings into a single string value, with a specified separator.
|
static String |
slug(String value)
Transform the input String value into a slug: a simpler adaptation that is compatible for usage inside an URI
(without requiring URL encoding).
|
static String |
toSIAbbreviation(TimeUnit timeUnit)
Return the SI abbreviation from the given TimeUnit name.
|
static String |
trailingSlash(String value)
Appends a final slash on a given value.
|
public static String join(String separator, Iterable<?> elements)
separator
- the separator to place between joined elements.elements
- the collection of strings to be joined.public static String join(String separator, Object... elements)
separator
- the separator to place between joined elements.elements
- the array of strings to be joined.public static String asString(InputStream is, Charset charset) throws IOException
is
- the input stream to be read.charset
- the character set encoding of the input stream.IOException
- If an I/O error occurs.public static String trailingSlash(String value)
value
- The given string.public static String slug(String value)
Examples:
slug("A sentence with blanks, commas and extra punctuation ! ")
.equals("a-sentence-with-blanks-commas-and-extra-punctuation");
slug("{ClientHandler}/heap/2").equals(clienthandler-heap-2);
value
- value to be transformedCopyright © 2025 Open Identity Platform Community. All rights reserved.