commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (NET-42) [net] Offset and resume not working...
Date Sat, 26 Feb 2011 14:53:58 GMT

     [ https://issues.apache.org/jira/browse/NET-42?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved NET-42.
---------------------

    Resolution: Won't Fix

The NET API requires the client application to provide the InputStream, which should be positioned
appropriately.

> [net] Offset and resume not working...
> --------------------------------------
>
>                 Key: NET-42
>                 URL: https://issues.apache.org/jira/browse/NET-42
>             Project: Commons Net
>          Issue Type: Bug
>          Components: FTP
>    Affects Versions: 1.4
>         Environment: Operating System: other
> Platform: All
>            Reporter: Marc
>
> 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??

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message