Package com.partnersoft.io.vfs

Virtual File System framework.

See: Description

Package com.partnersoft.io.vfs Description

Virtual File System framework.

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.
Author:
Paul Reavis, Russell Cagle