commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <GGreg...@seagullsoftware.com>
Subject RE: [vfs]
Date Thu, 21 Jul 2011 18:07:33 GMT
Hi Miroslav,

I think the best way to proceed is for you to create a JIRA and attach your code and unit
tests.

Thank you for sharing! :)
Gary

-----Original Message-----
From: Miroslav Pokorny [mailto:miroslav.pokorny@gmail.com] 
Sent: Wednesday, July 20, 2011 20:31 PM
To: Commons Users List
Subject: Re: [vfs]

Hi Gary,

While it is true that FTP is typically thought of as a streaming rather than random access
file system, VFS does support random access reading. This is confirmed of course by the list
of capabilities and code. I have a hacked version which supports random writing and does so
using the following strategy.


   - all read
      - if outputstream present flush and closeand clear
      - continue with reading byte(s)
      - seek
      - if outputstream present flush and closeand clear
      - perform seek.
      - // input and output streams are clear(nulled) and will be recreated
      by the next read / write
   - write methods
      - if outputstream is absent connect to server and restart at file
      pointer position
      - write byte(s).

While it appears to work, i thought there might have been some deeper reasoning behinid the
lack of inbuilt support in FtpFileProvider. After all that the same strategy is used for reading
as i have described for writing.
My code is however a mess as i have only implemented writing for some RandomAccessContent.

If anyone is interested id be happy to share.

On Jul 20, 2011, at 0:45, "Miroslav Pokorny" <miroslav.pokorny@gmail.com>
> wrote:
>
> > Hiho
> >
> > I was just playing with Apache Commons VFS (thanks guys) and noticed 
> > that
> >> Ftp FileSystem< does not support random access writing as confirmed 
> >> by
> > examining the capabilities.
> >
> > [LIST_CHILDREN, URI, GET_LAST_MODIFIED, RENAME, APPEND_CONTENT, 
> > DELETE, GET_TYPE, RANDOM_ACCESS_READ, READ_CONTENT, WRITE_CONTENT, 
> > CREATE]
> >
> > It does however support random accesss reading and im just wondering 
> > is there a particular reason why writing is not supported ?
> >
>
> Hello,
>
> The reason is probably as simple as the protocol is not a natural 
> match for the feature. With FTP you stream the whole file up or down, 
> not a random piece.
>
> Gary
>
> > tya
> >
> > mP
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>


--
mP

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


Mime
View raw message