code: public static void copyWithClose(InputStream input, OutputStream output) throws IOException {
          try {
              copy(input, output);
          } finally {
              try {
                  input.close();
              } catch (final IOException ignore) {
                  if (log.isLoggable(Level.FINER)) {
                      log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
                  }
              }
              try {
                  output.close();
              } catch (final IOException ignore) {
                  if (log.isLoggable(Level.FINER)) {
                      log.finer("Could not close stream due to: " + ignore.getMessage() + "; ignoring");
                  }
              }
          }
      }
docs: Copies the contents from an InputStream to an OutputStream and closes both streams.
  
  @param input
  @param output
  @throws IOException
  If a problem occurred during any I/O operations during the copy, but on closing the streams these
  will be ignored and logged at {@link Level#FINER}