com.partnersoft.io.vfs
Interface Vfs

All Known Implementing Classes:
AbstractVfs, FileVfs, HaversackVfs, UndoableVfs, WebstartVfs, YonderVfs, ZipVfs

public interface Vfs

A virtual file system.

Vfs serves three major purposes.

First, it embodies the concept of a hierarchical filesystem, rather than just a file or directory. File, while sufficient for most purposes, is primarily designed to represent a single file, and doing multiple file operations with it (recursive deletes or copies, directory searches, etc.) is very clumsy. A Vfs represents a filesystem as a whole.

Second, Vfs provides an abstraction from standard disk-based filesystems, allowing alternate storage implementations. VFSModules can be written which allow you to treat a website, FTP site, zipfile, database, or other data source as a hierarchical filesystem, without changing the code required by Vfs clients to examine and manipulate it.

Third, Vfs provides a wealth of convenience methods for examining and manipulating a filesystem. These are written in the spirit of UNIX tools such as cp, rm, and find. Recursively finding, copying, and deleting files are essential to serious file management, and File has no equivalents to these.

Copyright 2004-2007 Partner Software, Inc.

Author:
Paul Reavis

Method Summary
 VfsDirectory directoryFor(Path path)
          Returns a VfsDirectory for the given path.
 VfsDirectory directoryFor(java.lang.String pathString)
          Returns a VfsDirectory for the given path.
 VfsFile fileFor(Path path)
          Returns a VfsFile for the given path.
 VfsFile fileFor(java.lang.String pathString)
          Returns a VfsFile for the given path string.
 Path getAbsolutePath()
          Absolute path to the root of this Vfs.
 boolean isWritable()
          True if this module supports writing.
 

Method Detail

getAbsolutePath

Path getAbsolutePath()
Absolute path to the root of this Vfs. Meaning depends on type of Vfs.


isWritable

boolean isWritable()
True if this module supports writing.

Returns:
true if module is writable

fileFor

VfsFile fileFor(Path path)
Returns a VfsFile for the given path. Note that this does not imply that the underlying file actually exists. You may use the methods provided by the VfsFile to read and write the file's contents.

Parameters:
path - to file
Returns:
file for given path

directoryFor

VfsDirectory directoryFor(Path path)
Returns a VfsDirectory for the given path. Note that this does not imply that the underlying file actually exists. You may use the methods provided by the VfsDirectory to list and modify the directory's contents.

Parameters:
path - to directory
Returns:
directory for given path

fileFor

VfsFile fileFor(java.lang.String pathString)
Returns a VfsFile for the given path string. This is the same as fileFor(new Path(pathString).

Parameters:
pathString - string-encoded path to file
Returns:
file for given path

directoryFor

VfsDirectory directoryFor(java.lang.String pathString)
Returns a VfsDirectory for the given path. This is the same as directoryFor(new Path(pathString).

Parameters:
pathString - string-encoded path to directory
Returns:
directory for given path