MCPcopy
hub / github.com/apache/commons-io / copyToFile

Method copyToFile

src/main/java/org/apache/commons/io/FileUtils.java:1551–1559  ·  view source on GitHub ↗

Copies bytes from an InputStream source to a file destination . The directories up to destination will be created if they don't already exist. destination will be overwritten if it already exists. The source stream is left open, e.g.

(final InputStream source, final File destination)

Source from the content-addressed store, hash-verified

1549 * @since 2.5
1550 */
1551 public static void copyToFile(final InputStream source, final File destination) throws IOException {
1552 final FileOutputStream output = openOutputStream(destination);
1553 try {
1554 IOUtils.copy(source, output);
1555 output.close(); // don't swallow close Exception if copy completes normally
1556 } finally {
1557 IOUtils.closeQuietly(output);
1558 }
1559 }
1560
1561 //-----------------------------------------------------------------------
1562 /**

Callers 1

copyInputStreamToFileMethod · 0.95

Calls 4

openOutputStreamMethod · 0.95
copyMethod · 0.95
closeQuietlyMethod · 0.95
closeMethod · 0.45

Tested by

no test coverage detected