Package com.nimbusds.jose.util
Class IOUtils
java.lang.Object
com.nimbusds.jose.util.IOUtils
Input / output utilities.
- Version:
- 2020-02-23
- Author:
- Vladimir Dzhuvinov
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseSilently(Closeable closeable) Closes a Closeable without throwing an IOException.static StringreadFileToString(File file) Reads the content of the specified file into a string using UTF-8 character set encoding.static StringreadFileToString(File file, Charset charset) Reads the content of the specified file into a string.static StringreadInputStreamToString(InputStream stream) Reads the specified input stream into a string using UTF-8 character set encoding.static StringreadInputStreamToString(InputStream stream, Charset charset) Reads the specified input stream into a string.
-
Method Details
-
readInputStreamToString
Reads the specified input stream into a string using UTF-8 character set encoding.- Parameters:
stream- The input stream. Must not benull.- Returns:
- The string.
- Throws:
IOException- If an input exception is encountered.
-
readInputStreamToString
public static String readInputStreamToString(InputStream stream, Charset charset) throws IOException Reads the specified input stream into a string.- Parameters:
stream- The input stream. Must not benull.charset- The expected character set. Must not benull.- Returns:
- The string.
- Throws:
IOException- If an input exception is encountered.
-
readFileToString
Reads the content of the specified file into a string using UTF-8 character set encoding.- Parameters:
file- The file. Must not benull.- Returns:
- The string.
- Throws:
IOException- If an input exception is encountered.
-
readFileToString
Reads the content of the specified file into a string.- Parameters:
file- The file. Must not benull.charset- The expected character set. Must not benull.- Returns:
- The string.
- Throws:
IOException- If an input exception is encountered.
-
closeSilently
Closes a Closeable without throwing an IOException.- Parameters:
closeable- The closeable.
-