Package com.nimbusds.jose.util
Class IOUtils
- java.lang.Object
-
- com.nimbusds.jose.util.IOUtils
-
public class IOUtils extends java.lang.ObjectInput / output utilities.- Version:
- 2020-02-23
- Author:
- Vladimir Dzhuvinov
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseSilently(java.io.Closeable closeable)Closes a Closeable without throwing an IOException.static java.lang.StringreadFileToString(java.io.File file)Reads the content of the specified file into a string using UTF-8 character set encoding.static java.lang.StringreadFileToString(java.io.File file, java.nio.charset.Charset charset)Reads the content of the specified file into a string.static java.lang.StringreadInputStreamToString(java.io.InputStream stream)Reads the specified input stream into a string using UTF-8 character set encoding.static java.lang.StringreadInputStreamToString(java.io.InputStream stream, java.nio.charset.Charset charset)Reads the specified input stream into a string.
-
-
-
Method Detail
-
readInputStreamToString
public static java.lang.String readInputStreamToString(java.io.InputStream stream) throws java.io.IOExceptionReads 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:
java.io.IOException- If an input exception is encountered.
-
readInputStreamToString
public static java.lang.String readInputStreamToString(java.io.InputStream stream, java.nio.charset.Charset charset) throws java.io.IOExceptionReads 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:
java.io.IOException- If an input exception is encountered.
-
readFileToString
public static java.lang.String readFileToString(java.io.File file) throws java.io.IOExceptionReads 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:
java.io.IOException- If an input exception is encountered.
-
readFileToString
public static java.lang.String readFileToString(java.io.File file, java.nio.charset.Charset charset) throws java.io.IOExceptionReads 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:
java.io.IOException- If an input exception is encountered.
-
closeSilently
public static void closeSilently(java.io.Closeable closeable)
Closes a Closeable without throwing an IOException.- Parameters:
closeable- The closeable.
-
-