com.partnersoft.io
Class VFS

java.lang.Object
  extended by com.partnersoft.io.VFS

public class VFS
extends java.lang.Object

A virtual file system; basically it makes file access transparent whether you are running directly or off of Java Web Start or some other weird setup.

Author:
Paul Reavis Copyright 2004 Partner Software, Inc.

Constructor Summary
VFS()
           
VFS(java.io.File rootDir)
           
VFS(java.net.URL root)
           
VFS(java.net.URL root, java.lang.String systemPath)
           
 
Method Summary
 java.io.BufferedInputStream bufferedInputStreamFor(java.lang.String path)
           
 java.io.BufferedOutputStream bufferedOutputStreamFor(java.lang.String path)
           
 java.io.BufferedReader bufferedReaderFor(java.lang.String path)
           
 java.io.BufferedWriter bufferedWriterFor(java.lang.String path)
           
 byte[] bytesFor(java.lang.String path)
           
 boolean exists(java.lang.String path)
           
 java.io.InputStream inputStreamFor(java.lang.String path)
           
 boolean isDirectory(java.lang.String path)
           
 boolean isInitialized()
           
 long lastModified(java.lang.String path)
           
 VFSNode[] list(java.lang.String path)
           
 java.util.ArrayList listContentsRemoveExtension(java.lang.String path, java.lang.String extension)
           
 java.util.ArrayList listRecursive(java.lang.String path)
           
 void listRecursiveImp(java.lang.String path, java.util.ArrayList results)
           
 java.io.OutputStream outputStreamFor(java.lang.String path)
           
 VFSRandomAccess randomAccessFor(java.lang.String path)
           
 java.io.Reader readerFor(java.lang.String path)
           
 java.lang.String readLine(java.lang.String path)
          Reads the first line of a file in as a single String.
 java.lang.String readText(java.lang.String path)
          Reads the entire contents of a file as a single String.
 void remove(java.lang.String path)
           
 void removeRecursive(java.lang.String path)
           
static VFS singleton()
           
 int sizeOf(java.lang.String path)
           
 java.lang.String toString()
           
 void writeLine(java.lang.String path, java.lang.String line)
          Writes a string to a file as a single line.
 java.io.Writer writerFor(java.lang.String path)
           
 void writeText(java.lang.String path, java.lang.String contents)
          Writes the entire contents of a file as a single String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VFS

public VFS()

VFS

public VFS(java.net.URL root)

VFS

public VFS(java.net.URL root,
           java.lang.String systemPath)

VFS

public VFS(java.io.File rootDir)
Method Detail

singleton

public static VFS singleton()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isInitialized

public boolean isInitialized()

inputStreamFor

public java.io.InputStream inputStreamFor(java.lang.String path)
                                   throws java.io.IOException
Throws:
java.io.IOException

outputStreamFor

public java.io.OutputStream outputStreamFor(java.lang.String path)
                                     throws java.io.IOException
Throws:
java.io.IOException

randomAccessFor

public VFSRandomAccess randomAccessFor(java.lang.String path)
                                throws java.io.IOException
Throws:
java.io.IOException

exists

public boolean exists(java.lang.String path)
               throws java.io.IOException
Throws:
java.io.IOException

isDirectory

public boolean isDirectory(java.lang.String path)
                    throws java.io.IOException
Throws:
java.io.IOException

sizeOf

public int sizeOf(java.lang.String path)
           throws java.io.IOException
Throws:
java.io.IOException

remove

public void remove(java.lang.String path)
            throws java.io.IOException
Throws:
java.io.IOException

removeRecursive

public void removeRecursive(java.lang.String path)
                     throws java.io.IOException
Throws:
java.io.IOException

list

public VFSNode[] list(java.lang.String path)
               throws java.io.IOException
Throws:
java.io.IOException

lastModified

public long lastModified(java.lang.String path)
                  throws java.io.IOException
Throws:
java.io.IOException

listRecursive

public java.util.ArrayList listRecursive(java.lang.String path)
                                  throws java.io.IOException
Throws:
java.io.IOException

listRecursiveImp

public void listRecursiveImp(java.lang.String path,
                             java.util.ArrayList results)
                      throws java.io.IOException
Throws:
java.io.IOException

bufferedInputStreamFor

public java.io.BufferedInputStream bufferedInputStreamFor(java.lang.String path)
                                                   throws java.io.IOException
Throws:
java.io.IOException

bufferedOutputStreamFor

public java.io.BufferedOutputStream bufferedOutputStreamFor(java.lang.String path)
                                                     throws java.io.IOException
Throws:
java.io.IOException

readerFor

public java.io.Reader readerFor(java.lang.String path)
                         throws java.io.IOException
Throws:
java.io.IOException

bufferedReaderFor

public java.io.BufferedReader bufferedReaderFor(java.lang.String path)
                                         throws java.io.IOException
Throws:
java.io.IOException

writerFor

public java.io.Writer writerFor(java.lang.String path)
                         throws java.io.IOException
Throws:
java.io.IOException

bufferedWriterFor

public java.io.BufferedWriter bufferedWriterFor(java.lang.String path)
                                         throws java.io.IOException
Throws:
java.io.IOException

bytesFor

public byte[] bytesFor(java.lang.String path)
                throws java.io.IOException
Throws:
java.io.IOException

listContentsRemoveExtension

public java.util.ArrayList listContentsRemoveExtension(java.lang.String path,
                                                       java.lang.String extension)
                                                throws java.io.IOException
Throws:
java.io.IOException

readLine

public java.lang.String readLine(java.lang.String path)
                          throws java.io.IOException
Reads the first line of a file in as a single String.

Throws:
java.io.IOException

writeLine

public void writeLine(java.lang.String path,
                      java.lang.String line)
               throws java.io.IOException
Writes a string to a file as a single line.

Throws:
java.io.IOException

readText

public java.lang.String readText(java.lang.String path)
                          throws java.io.IOException
Reads the entire contents of a file as a single String.

Throws:
java.io.IOException

writeText

public void writeText(java.lang.String path,
                      java.lang.String contents)
               throws java.io.IOException
Writes the entire contents of a file as a single String.

Throws:
java.io.IOException