commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32378] New: - Use java.nio for copyFile(File source, File destination)
Date Wed, 24 Nov 2004 11:46:26 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32378>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32378

           Summary: Use java.nio for copyFile(File source, File destination)
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: IO
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jamesm@itouch.co.za


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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message