Resuming downloads

Top  Previous  Next

If a file fails to download completely you can resume the download using any of the Ftp#resumeDownload methods.  Prior to using the Ftp#resumeDownload method you must first determine how much of the file in bytes was successfully downloaded.  To do this you may use the java.io.File.length method which will return the length of the local file in bytes.

 

Example

 

// get length of local file

long offset = new File("c:/setup.zip").length();

 

// set local directory

ftp.setLocalDir(new File("c:/"));

 

// resume file download starting from offset

ftp.resumeDownload("setup.zip",offset);

 

 

Note

 

Resuming downloads is only possible when transferring files in binary mode.  Resuming a transfer in ASCII mode is not supported.

 





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC