Class IoUtils
java.lang.Object
software.amazon.awssdk.utils.IoUtils
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidcloseIfCloseable(Object maybeCloseable, org.slf4j.Logger log) Deprecated.static voidcloseIfCloseableV2(Object maybeCloseable, Logger log) Closes the given Closeable quietly.static voidcloseQuietly(AutoCloseable is, org.slf4j.Logger log) Deprecated.usecloseQuietlyV2(AutoCloseable, Logger)insteadstatic voidcloseQuietlyV2(AutoCloseable is, Logger log) Closes the given Closeable quietly.static longcopy(InputStream in, OutputStream out) Copies all bytes from the given input stream to the given output stream.static longcopy(InputStream in, OutputStream out, long readLimit) Copies all bytes from the given input stream to the given output stream.static voidRead all remaining data in the stream.static voidIf the stream supports marking, marks the stream at the current position with areadLimitvalue of 128 KiB.static voidmarkStreamWithMaxReadLimit(InputStream s, Integer maxReadLimit) If the stream supports marking, marks the stream at the current position with a read limit specified inmaxReadLimit.static byte[]Reads and returns the rest of the given input stream as a byte array.static StringReads and returns the rest of the given input stream as a string.
- 
Method Details- 
toByteArrayReads and returns the rest of the given input stream as a byte array. Caller is responsible for closing the given input stream.- Throws:
- IOException
 
- 
toUtf8StringReads and returns the rest of the given input stream as a string. Caller is responsible for closing the given input stream.- Throws:
- IOException
 
- 
closeQuietlyDeprecated.usecloseQuietlyV2(AutoCloseable, Logger)insteadCloses the given Closeable quietly.- Parameters:
- is- the given closeable
- log- logger used to log any failure should the close fail
 
- 
closeQuietlyV2Closes the given Closeable quietly.- Parameters:
- is- the given closeable
- log- logger used to log any failure should the close fail
 
- 
closeIfCloseableDeprecated.usecloseQuietlyV2(AutoCloseable, Logger)insteadCloses the given Closeable quietly.- Parameters:
- maybeCloseable- the given closeable
- log- logger used to log any failure should the close fail
 
- 
closeIfCloseableV2
- 
copyCopies all bytes from the given input stream to the given output stream. Caller is responsible for closing the streams.- Throws:
- IOException- if there is any IO exception during read or write.
 
- 
copyCopies all bytes from the given input stream to the given output stream. Caller is responsible for closing the streams.- Throws:
- IOException- if there is any IO exception during read or write or the read limit is exceeded.
 
- 
drainInputStreamRead all remaining data in the stream.- Parameters:
- in- InputStream to read.
 
- 
markStreamWithMaxReadLimitIf the stream supports marking, marks the stream at the current position with areadLimitvalue of 128 KiB.- Parameters:
- s- The stream.
 
- 
markStreamWithMaxReadLimitIf the stream supports marking, marks the stream at the current position with a read limit specified inmaxReadLimit.- Parameters:
- s- The stream.
- maxReadLimit- the maxReadLimit, if it's null, 128 KiB will be used.
 
 
- 
closeQuietlyV2(AutoCloseable, Logger)instead