public final class IoUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeIfCloseable(Object maybeCloseable,
org.slf4j.Logger log)
Closes the given Closeable quietly.
|
static void |
closeQuietly(AutoCloseable is,
org.slf4j.Logger log)
Closes the given Closeable quietly.
|
static long |
copy(InputStream in,
OutputStream out)
Copies all bytes from the given input stream to the given output stream.
|
static void |
drainInputStream(InputStream in)
Read all remaining data in the stream.
|
static byte[] |
toByteArray(InputStream is)
Reads and returns the rest of the given input stream as a byte array.
|
static String |
toString(InputStream is)
Reads and returns the rest of the given input stream as a string.
|
public static byte[] toByteArray(InputStream is) throws IOException
IOExceptionpublic static String toString(InputStream is) throws IOException
IOExceptionpublic static void closeQuietly(AutoCloseable is, org.slf4j.Logger log)
is - the given closeablelog - logger used to log any failure should the close failpublic static void closeIfCloseable(Object maybeCloseable, org.slf4j.Logger log)
is - the given closeablelog - logger used to log any failure should the close failpublic static long copy(InputStream in, OutputStream out) throws IOException
IOException - if there is any IO exception during read or write.public static void drainInputStream(InputStream in)
in - InputStream to read.Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.