public class IOUtils extends Object
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanup(org.slf4j.Logger log,
Closeable... closeables)
Close the Closeable objects and ignore any
IOException or
null pointers. |
static void |
closeStream(Closeable stream)
Closes the stream ignoring
IOException . |
static void |
copyBytes(InputStream in,
OutputStream out,
int buffSize)
Copies from one stream to another.
|
static void |
copyBytes(InputStream in,
OutputStream out,
int buffSize,
boolean close)
Copies from one stream to another.
|
public static void closeStream(Closeable stream)
IOException
. Must only be called in
cleaning up from exception handlers.stream
- the Stream to closepublic static void cleanup(org.slf4j.Logger log, Closeable... closeables)
IOException
or
null pointers. Must only be used for cleanup in exception handlers.log
- the log to record problems to at debug level. Can be null.closeables
- the objects to closepublic static void copyBytes(InputStream in, OutputStream out, int buffSize, boolean close) throws IOException
in
- InputStrem to read fromout
- OutputStream to write tobuffSize
- the size of the bufferclose
- whether or not close the InputStream and OutputStream at the
end. The streams are closed in the finally clause.IOException
public static void copyBytes(InputStream in, OutputStream out, int buffSize) throws IOException
in
- InputStrem to read fromout
- OutputStream to write tobuffSize
- the size of the bufferIOException
Copyright © 2008–2020 The Apache Software Foundation. All rights reserved.