IOUtilsclass provides a number of convenience methods to handle most IO operations. One of my favorite methods is
IOUtils.copy(InputStream input, OutputStream output). A simple method, but so very useful since it is so common.
Have you ever needed to create unit tests on methods which require a closed
OutputStream. I am sure you have, if not you just have not gotten there yet. Apache Commons IO offers you
There are some other nice classes especially for debugging like
CountingOutputStreamwhich records the number of bytes read, or written. I can see another use for cloud computing models where you are charged for data transfers. This can help you keep track of those numbers for comparison with your charges.
If you have not taken the time to look at these great tools, take a couple of minutes to just look at the javadocs. I am sure you will be impressed like me.