public final class StringToolkit extends Object
Modifier and Type | Method and Description |
---|---|
static String |
encodeFilename(String string)
Encode a string so that it becomes safe to use as a file name.
|
static String |
join(Collection<?> s,
String delimiter)
Joins items in collection to one string with delimiter between each item.
|
static String |
join(Object[] a,
String delimiter)
Joins items in an array to one string with delimiter between each item.
|
static String |
readString(InputStream in)
Reads the contents of a stream to a string, assuming UTF-8 encoding.
|
static String |
readString(InputStream in,
String charsetName)
Reads the contents of a stream with specified character encoding to a string.
|
public static String readString(InputStream in) throws IOException
in
- the stream to read fromIOException
- if something went wrongpublic static String readString(InputStream in, String charsetName) throws IOException
in
- the stream to read fromcharsetName
- the name of a supported charset
IOException
- if something went wrongpublic static String encodeFilename(String string)
string
- string to encodepublic static String join(Collection<?> s, String delimiter)
s
- collection of itemsdelimiter
- string to put between collection itemsCopyright © 2020. All rights reserved.