src/main/java/io/arivera/oss/embedded/rabbitmq/apache/commons/io/FileUtils.java
public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
    try {
      FileOutputStream output = openOutputStream(destination);
      try {
        copy(source, output);
        output.close(); // don't swallow close Exception if copy completes normally
      } finally {
        closeQuietly(output);
      }
    } finally {
      closeQuietly(source);
    }
  }
public static void copyInputStreamToFile(InputStream source, File destination) throws IOException {
    try {
      FileOutputStream output = openOutputStream(destination);
      try {
        copy(source, output);
        output.close(); // don't swallow close Exception if copy completes normally
      } finally {
        closeQuietly(output);
      }
    } finally {
      closeQuietly(source);
    }
  }
Copies bytes from an {@link InputStream} <code>source</code> to a file
<code>destination</code>. The directories up to <code>destination</code>
will be created if they don't already exist. <code>destination</code>
will be overwritten if it already exists.

@param source      the <code>InputStream</code> to copy bytes from, must not be {@code null}
@param destination the non-directory <code>File</code> to write bytes to
(possibly overwriting), must not be {@code null}
@throws IOException if <code>destination</code> is a directory
@throws IOException if <code>destination</code> cannot be written
@throws IOException if <code>destination</code> needs creating but can't be
@throws IOException if an IO error occurs during copying
@since 2.0