Gary Gregory created IO-381:
-------------------------------
Summary: Add FileUtils.copyInputStreamToFile API with option to
leave the source open
Key: IO-381
URL: https://issues.apache.org/jira/browse/IO-381
Project: Commons IO
Issue Type: New Feature
Components: Utilities
Environment: Apache Maven 3.0.5
(r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: C:\Java\apache-maven-3.0.5\bin\..
Java version: 1.7.0_17, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_17\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Reporter: Gary Gregory
Assignee: Gary Gregory
Fix For: 2.5
Add the API: {{copyInputStreamToFile(final InputStream source, final File
destination, boolean closeSource)}}
{code:java}
/**
* 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}, will be closed
* @param destination the non-directory <code>File</code> to write bytes to
* (possibly overwriting), must not be {@code null}
* @param closeSource If true, closes the <code>source</code>
* @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.5
*/
public static void copyInputStreamToFile(final InputStream source, final
File destination, boolean closeSource)
throws IOException {
{code}
Related to [IO-380].
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira