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=39076>. 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=39076 Summary: Offset and resume not working... Product: Commons Version: 1.4 Final Platform: All OS/Version: other Status: NEW Severity: normal Priority: P2 Component: File Upload AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] CC: [email protected] When setting the restart offset : setRestartOffset(long offset) one would expect that when resuming storing the same file on the server, it will restart from that offset and not from beggining. I made the follwoing change (-->><<--) in the org.apache.commons.net.io.Util class public static final long copyStream(long offset, source,... ... try { -->> source.skip(offset); <<-- while ((bytes = source.read(buffer)) != -1) { ... This change allows to skip the bytes until the offset mark. In the main code there is of course a need to set : ftpClient.setRestartOffset(dest_file_size); output = ftp.storeFileStream("filename"); dest_file_size was calculated using the following code as I haven't found a method return the size of the file: static long getSize(FTPFile[] ftpFiles, String filename){ for(int i=0; i<ftpFiles.length;i++){ if (ftpFiles[i].getName().equalsIgnoreCase(filename)){ return ftpFiles[i].getSize(); } } return -1; } where ftpFiles = ftpClient.initiateListParsing().getFiles(); What do you think?? -- 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. You are on the CC list for the bug, or are watching someone who is. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
