I'm not a developer of [vfs], only a user, but having
seen the source code for the File class, it's not worth
the effort to subclass.  Most people anyway make assumptions
when they see a "File" object (as they should).  One of the
basic assumptions is that they can pass it to a FileReader
or FileInputStream to read it.  Which, of course, if you
subclass File for something that is not really a local file,
isn't going to work very well.  The constructor of
FileInputStream calls the native method "open", which is
coded for local files.

As a result, it's much better to create a new abstraction
(which they've done), so there's no confusion, and less
potential for error.


-----Original Message-----
From: Gary Gregory [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 13, 2003 2:20 PM
To: 'Jakarta Commons Developers List'
Subject: [vsf] WAS: [general] Zip file proxy?


Ah, yes, I do recall seing this component, it quite impressive. Could a
[vsf] developer comment on the possibility of a java.io.File subclass (or
subclasses)? I'd rather not port code...

Gary

> -----Original Message-----
> From: Inger, Matthew [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 13, 2003 10:53
> To: 'Jakarta Commons Developers List'
> Subject: RE: [general] Zip file proxy?
> 
> Try commons-vfs
> 
> under the sandbox.  You can't treat it as a java.io.File, but there
> is a seperate FileObject which abstractly represents a file from any
> given file system.  Some of the supported filesystems include local,
> jar,zip,http,ftp,cifs (windows share),etc...
> 
> Comes with a nice set of ANT tasks as well. :)
> 
> 
> 
> -----Original Message-----
> From: Gary Gregory [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 13, 2003 1:49 PM
> To: 'Jakarta Commons Developers List'
> Subject: [general] Zip file proxy?
> 
> 
> Hello,
> 
> Does anyone know of a doo-dad in Commons or somewhere that would allow me
> to
> use a .zip file (and other compressed format) as java.io.File /directory/.
> What I have found so far (can't recall now) only works if your code uses a
> whole framework of proxies/wrappers. Ideally, such a subclass of File
> should
> let me traverse the archive just as if it were a directory on disk, which
> would allow my current pile of File-based code to work as is.
> 
> Thanks,
> Gary

Reply via email to