Package org.apache.zookeeper.common
Class IOUtils
- java.lang.Object
- 
- org.apache.zookeeper.common.IOUtils
 
- 
 public class IOUtils extends Object 
- 
- 
Constructor SummaryConstructors Constructor Description IOUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanup(org.slf4j.Logger log, Closeable... closeables)Close the Closeable objects and ignore anyIOExceptionor null pointers.static voidcloseStream(Closeable stream)Closes the stream ignoringIOException.static voidcopyBytes(InputStream in, OutputStream out, int buffSize)Copies from one stream to another.static voidcopyBytes(InputStream in, OutputStream out, int buffSize, boolean close)Copies from one stream to another.
 
- 
- 
- 
Method Detail- 
closeStreampublic static void closeStream(Closeable stream) Closes the stream ignoringIOException. Must only be called in cleaning up from exception handlers.- Parameters:
- stream- the Stream to close
 
 - 
cleanuppublic static void cleanup(org.slf4j.Logger log, Closeable... closeables)Close the Closeable objects and ignore anyIOExceptionor null pointers. Must only be used for cleanup in exception handlers.- Parameters:
- log- the log to record problems to at debug level. Can be null.
- closeables- the objects to close
 
 - 
copyBytespublic static void copyBytes(InputStream in, OutputStream out, int buffSize, boolean close) throws IOException Copies from one stream to another.- Parameters:
- in- InputStrem to read from
- out- OutputStream to write to
- buffSize- the size of the buffer
- close- whether or not close the InputStream and OutputStream at the end. The streams are closed in the finally clause.
- Throws:
- IOException
 
 - 
copyBytespublic static void copyBytes(InputStream in, OutputStream out, int buffSize) throws IOException Copies from one stream to another.- Parameters:
- in- InputStrem to read from
- out- OutputStream to write to
- buffSize- the size of the buffer
- Throws:
- IOException
 
 
- 
 
-