2

I have an application that uses VFS to download files over FTP or SFTP. When the file is large and the network connection is lost I currently have to start the download again.

Is it possible to do a resumable file download with VFS?

zorro2b
  • 2,227
  • 4
  • 28
  • 45

1 Answers1

1

I found an answer in the commons email archives:

You can use the RandomAccessContent:

FileObject fo = VFS.getManager().resolveFile("ftp://..."); 
RandomAccessContent rac = fo.getContent().getRandomAccessContent(RandomAccessMode.READ);
rac.seek(4711);

If you need a InputStream you can aquire one by using:

InputStream is = rac.getInputStream(); 
zorro2b
  • 2,227
  • 4
  • 28
  • 45