public static void copyToFile(final InputStream source, final File destination) throws IOException {
        final FileOutputStream output = openOutputStream(destination);
        try {
            IOUtils.copy(source, output);
            output.close(); // don't swallow close Exception if copy completes normally
        } finally {
            CloseableUtils.closeQuietly(output);
        }
    }
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.
The {@code source} stream is left open, e.g. for use with {@link java.util.zip.ZipInputStream ZipInputStream}.
See {@link #copyInputStreamToFile(InputStream, File)} for a method that closes the input stream.

@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
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/replugin/utils/FileUtils.java