You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/05/18 19:42:06 UTC

[jira] Resolved: (IO-50) [io] Use java.nio for copyFile(File source, File destination)

     [ http://issues.apache.org/jira/browse/IO-50?page=all ]
     
Henri Yandell resolved IO-50:
-----------------------------

    Resolution: Won't Fix

Marking this as a won't do.

Even if someone did a fancy reflection version we shouldn't add it as it would be a maintenance pain.

Sorry James.

> [io] Use java.nio for copyFile(File source, File destination)
> -------------------------------------------------------------
>
>          Key: IO-50
>          URL: http://issues.apache.org/jira/browse/IO-50
>      Project: Commons IO
>         Type: Improvement

>     Versions: 1.0 Final
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: jamesm
>     Priority: Minor

>
> I suggest research into making the following change in FileUtils.java, to 
> replace the current block of code which does the copying:
> --- begin ---
> FileInputStream input = new FileInputStream(source);
> try {
>     FileOutputStream output = new FileOutputStream(destination);
>     try {
>         FileChannel inputChannel = fileIn.getChannel();
>         FileChannel outputChannel = fileOut.getChannel();
>         inputChannel.transferTo(0, source.length(), outputChannel);
>     }
>     finally {
>         IOUtils.closeQuietly(output);
>     }
> }
> finally {
>     IOUtils.closeQuietly(input);
> }
> --- end ---
> I believe this may be faster as it uses the operating system directly. There is 
> also the option of providing this method under a different name, e.g. 
> copyFileNIO.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org