Package com.nimbusds.jose.util
Class IOUtils
- java.lang.Object
-
- com.nimbusds.jose.util.IOUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
readInputStreamToString
public static String readInputStreamToString(InputStream stream) throws IOException
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
public static String readFileToString(File file) throws IOException
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
public static String readFileToString(File file, Charset charset) throws IOException
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
public static void closeSilently(Closeable closeable)
Closes a Closeable without throwing an IOException.- Parameters:
closeable- The closeable.
-
-