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 Thu, 17 Feb 2005 04:58:48 GMT
Mario,

I was just testing some stuff out against ftp servers on the internet 
and noticed that getInputStream() on FtpRandomAccessContent doesn't call 
createStream() so I'm getting NPE since I don't do any of the other 
readXXX methods.  I'll try out some more stuff tomorrow at work against 
our servers.  Here's my fugly change to that method ( since it isn't 
allowed to throw checked exceptions ), you probably have a much better 
idea for this:

public InputStream getInputStream()
{
   try
   {
     createStream();
   }
   catch (IOException e)
   {
     throw new RuntimeException(e);
   }
   return dis;
}

Once in place my simple test worked ( forgive the FQN's, I was trying 
out Eclipse's Scrapbook pages for this ):

org.apache.commons.vfs.FileSystemManager fs = 
org.apache.commons.vfs.VFS.getManager();

org.apache.commons.vfs.FileObject fo = 
fs.resolveFile("ftp://ibiblio.org/README");

org.apache.commons.vfs.RandomAccessContent content = 
fo.getContent().getRandomAccessContent(org.apache.commons.vfs.util.RandomAccessMode.READ);

content.seek(50);

java.io.InputStream in = content.getInputStream();

org.apache.commons.net.io.Util.copyStream(in,System.out);

----

Mario Ivankovits wrote:
> Jeffrey D. Brekke wrote:
> 
>> If you get something committed, like some tests, I could try here...
> 
> Its done now. It would be nice if you could test it against your sever.
> 
> 
> Thanks!
> 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