commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <>
Subject Re: [vfs]: FileSystemManage.createFileSystem(FileObject)
Date Sun, 23 May 2004 11:50:50 GMT
Paul Smith wrote:

> <>FileObject FileSystemManage.createFileSystem(FileObject)
> Do I interpret this code that if I had a FileObject that was a remote Zip
> file, that the returned FileObject would represent a 'directory' of 
> the Zip
> contents?


> <>Is that the case? <cross-fingers>true</cross-fingers>


> <>If this is the case, is there some way through the
> FileObject/FileSystemManager interfaces whether a particular FileObject is
> able to be translated into a virtual FileObject? Given any arbitary
> FileObject, how can my code know whether this object could be mounted as a
> virtualy file system root.

            if (manager.canCreateFileSystem(file))
                // Use contents of the file
                file = manager.createFileSystem(file);

If the manager returns true on canCreateFileSystem depends on the 
"mime-type-map" entries in providers.xml.

first the java internal methods to determine the mimetype (by filename) 
is used and a lookup on mime-type-map is done:

    <mime-type-map mimetype="application/zip" scheme="zip"/>

if this fails, vfs tries to find an entry using the extension in the 

    <extension-map extension="jar" scheme="jar"/>

if a scheme is found this file "canCreate-A-FileSystem".

There is a todo from the old authors to implement this more 
transparently - i will pick this up as one of the next vfs things i will do.
Maybe a new hasChildren() and then a simple getChildren() might do the job.
However, for now the above if/create should make it too.

-- Mario

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message