Resuming downloads

Top  Previous  Next

If a file fails to download completely you can resume the download using any of the Ftps#resumeDownload methods.  Prior to using the Ftps#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

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

 

// resume file download starting from offset

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