code: protected long copyClose(InputStream in, OutputStream out) throws IOException
     {
        try
        {
           try
           {
              return copy(in, out);
           }
           finally
           {
              in.close();
           }
        }
        finally
        {
           out.close();
        }
     }
docs: Copy input to output data using NIO. Input and output streams will be closed after the
  operation.
  
  @param in
  InputStream
  @param out
  OutputStream
  @return The number of bytes, possibly zero, that were actually copied
  @throws IOException
  if error occurs