commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeffrey D. Brekke" <jbre...@wi.rr.com>
Subject Re: VFS ranged downloads?
Date Mon, 14 Feb 2005 22:18:54 GMT
Very interesting.  Some ftp servers do not support the REST command, 
would it seek from the beginning in those cases?

Mario Ivankovits wrote:
> Marcus Crafter wrote:
> 
>> Hope all is going well.
> 
> Thanks!
> 
>> Was just wondering if it's possible to perform a range requested 
>> donwload using commons VFS currently? I checked out the API but didn't 
>> see anything that allowed one to specify a start byte and range, etc.
> 
> There is a RandomAccessContent which makes it possible to access every 
> file in an random manner. Though, it wasnt implemented for FTP (now it is).
> 
> FileObject fo = 
> VFS.getManager().resolveFile("ftp://your-ftp/large-file.bin");
> RandomAccessContent ra = 
> fo.getContent().getRandomAccessContent(RandomAccessMode.READ);
> ra.seek(20);
> ra.readFully(buf);
> 
> or
> 
> InputStream is = ra.getInputStream();
> 
> Well - thats it. Using seek() you could set what ftp calls 
> "restartOffset" (REST)
> 
> I have to do some tests and will commit it in the next few days.
> 
> ---
> Mario
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org

-- 
=====================================================================
Jeffrey D. Brekke                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                     ekkerbj@yahoo.com
                                                     ekkerbj@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message