public final class IOUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(java.io.Closeable closeable)
Closes a
Closeable object quietly, suppressing any exceptions
that might occur during the close operation. |
static long |
copy(java.io.InputStream input,
java.io.OutputStream output)
Copies all bytes from the provided input stream to the given output stream.
|
static byte[] |
toByteArray(java.io.InputStream input)
Converts the contents of the provided InputStream into a byte array.
|
static java.lang.String |
toString(java.io.Reader reader)
Converts the contents of the provided Reader into a String.
|
public static long copy(java.io.InputStream input,
java.io.OutputStream output)
throws java.io.IOException
input - the InputStream to read data from, must not be nulloutput - the OutputStream to write data to, must not be nulljava.io.IOException - if an I/O error occurs during reading or writingpublic static byte[] toByteArray(java.io.InputStream input)
throws java.io.IOException
input - the InputStream to read data from, must not be nulljava.io.IOException - if an I/O error occurs while reading from the InputStreampublic static java.lang.String toString(java.io.Reader reader)
throws java.io.IOException
reader - the Reader to read data from, must not be nulljava.io.IOException - if an I/O error occurs while reading from the Readerpublic static void closeQuietly(java.io.Closeable closeable)
Closeable object quietly, suppressing any exceptions
that might occur during the close operation. If the provided Closeable
is null, this method does nothing.closeable - the Closeable object to close; may be null.Copyright 1999-2026 The Apache Software Foundation. All Rights Reserved.