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 28497] New: - BufferedIO in FileUtils.copyFile
Date Tue, 20 Apr 2004 13:29:48 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=28497>.
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=28497

BufferedIO in FileUtils.copyFile

           Summary: BufferedIO in FileUtils.copyFile
           Product: Commons
           Version: 1.0 Alpha
          Platform: All
               URL: http://??
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: IO
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: drizzi@largesys.it


org.apache.commons.io.FileUtils.copyFile(src, dest)
will copy byte-per-byte from source to destination, without
any buffering (AFAIK).
I'd suggest this tweaking:

----------- in FileUtils.copyFile ------------



       //original code
        /*
        FileInputStream input = new FileInputStream(source);
        try {
            FileOutputStream output = new FileOutputStream(destination);
            try {
                CopyUtils.copy(input, output);
            } finally {
                IOUtils.closeQuietly(output);
            }
        } finally {
            IOUtils.closeQuietly(input);
        }
        */
        
        //slightly enhanced
        InputStream input = new BufferedInputStream(new FileInputStream
(source));
        try {
            OutputStream output = new BufferedOutputStream(new FileOutputStream
(destination));
            try {
                CopyUtils.copy(input, output);
            } finally {
                IOUtils.closeQuietly(output);
            }
        } finally {
            IOUtils.closeQuietly(input);
        }

--- end --

and by the way changing the object definitions to Interface defs,
that is from 
FileInputStream fis = new FileInputStream();
to
InputStream fis = new FileInputStream();
 

hope somebody will like it 
daniele rizzi (drizzi@largesys.it)

---------------------------------------------------------------------
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