| Interface | Description |
|---|---|
| Vfs |
A virtual file system.
|
| VfsDirectory |
A directory in a Virtual File System (Vfs).
|
| VfsFile |
Address and handle for a file in a Vfs.
|
| VfsNode |
Abstract node in a hierarchical filesystem (specifically a Vfs).
|
| VfsRandomAccess |
A random-access file in a Vfs.
|
| Class | Description |
|---|---|
| AbstractExplicitTreeVfs |
A basic (and fairly simpleminded) implementation of a Vfs.
|
| AbstractVfs |
Starter implementation of a Vfs.
|
| AbstractVfsDirectory |
A standard abstract implementation of com.partnersoft.io.VfsDirectory.
|
| AbstractVfsFile |
A standard abstract implementation of com.partnersoft.io.VfsFile.
|
| AbstractVfsRandomAccess |
A random-access file in a Vfs.
|
| FileVfs |
A Vfs implementation based on local files and directories.
|
| NonexistentVfsDirectory |
A VfsDirectory handle for a directory that does not exist in a read-only VFS.
|
| NonexistentVfsFile |
A VfsFile handle for a file that does not exist in a read-only VFS.
|
| UndoableVfs |
A wrapper around an editable VFS that allows transactional undo.
|
| VfsLib |
Various handy tools for manipulating VFSen.
|
| VfsRandomAccessInputStream |
A wrapper implementation of InputStream that forwards
all I/O to an enclosed VfsRandomAccess object.
|
| VfsRandomAccessOutputStream |
A wrapper implementation of OutputStream that forwards
all I/O to an enclosed VfsRandomAccess object.
|
This framework addresses the need for treating URLs, archives, and other such hierarchical structures just like files and directories.
It also provides a more convenient method of dealing with regular filesystems than java.util.File. Directories are expressed explicitly, and both directory and file objects have a large number of convenience methods that eliminate the need to import and instantiate dozens of java.io classes just to do something simple like read a line from a file.
The actual directory and file objects are immutable handles, created as needed. This is similar to the way java.io.File works, and does provide some advantages over e.g. a file object whose state changes as you move or modify it. Do keep it in mind, however, that when you do a file move or copy you are not actually changing the VfsFile or VfsDirectory objects as stored in memory.
Here is a basic example, reading all .txt files from a directory and logging them.
VfsDirectory dir = SystemServices.vfs().directoryFor(new Path("data/text/");
List files = dir.listFilesLike(".\*\.txt");
for (VfsFile file : files) {
log.info("File " + file.getBaseName() + "
Copyright 2006-2007 Partner Software, Inc.