Class IOUtils
- java.lang.Object
-
- software.amazon.cloudwatchlogs.emf.util.IOUtils
-
public class IOUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseQuietly(java.io.Closeable is, org.slf4j.Logger log)Closes the given Closeable quietly.static byte[]toByteArray(java.io.InputStream is)Reads and returns the rest of the given input stream as a byte array.static java.lang.StringtoString(java.io.InputStream is)Reads and returns the rest of the given input stream as a string.
-
-
-
Method Detail
-
toByteArray
public static byte[] toByteArray(java.io.InputStream is) throws java.io.IOExceptionReads and returns the rest of the given input stream as a byte array. It's the caller's responsibility to close the stream after the read.- Parameters:
is- an InputStream- Returns:
- a byte array of all content in the InputStream
- Throws:
java.io.IOException- If there were any problems reading from the stream
-
toString
public static java.lang.String toString(java.io.InputStream is) throws java.io.IOExceptionReads and returns the rest of the given input stream as a string. It's the caller's responsibility to close the stream after the read.- Parameters:
is- an InputStream- Returns:
- the string from the content of the input stream
- Throws:
java.io.IOException- If there were any problems reading from the stream
-
closeQuietly
public static void closeQuietly(java.io.Closeable is, org.slf4j.Logger log)Closes the given Closeable quietly.- Parameters:
is- the given closeablelog- logger used to log any failure should the close fail
-
-