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?
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?
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();