com.caucho.vfs
Class Vfs

java.lang.Object
  |
  +--com.caucho.vfs.Vfs

public final class Vfs
extends java.lang.Object

Facade to create useful Path and Stream objects.

 Path path = Vfs.lookup("foo.html");
 

The default scheme is the file scheme. Other schemes are available using the full url.

 Path mail = Vfs.lookup("mailto:drofnats@foo.com.test?subject='hi'");
 Stream body = mail.openWrite();
 body.writeln("How's it going?");
 body.close();
 


Method Summary
static Path lookup()
          Returns a path for the current directory.
static Path lookup(java.lang.String url)
          Returns a new path relative to the current directory.
static Path lookup(java.lang.String url, java.util.Map attr)
          Returns a new path, including attributes.
static Path lookupNative(java.lang.String url)
          Returns a path using the native filesystem conventions.
static Path lookupNative(java.lang.String url, java.util.Map attr)
          Returns a native filesystem path with attributes.
static WriteStream openAppend(java.lang.String path)
           
static ReadStream openRead(java.io.InputStream is)
          Creates new ReadStream from an InputStream
static ReadStream openRead(java.io.InputStream is, WriteStream ws)
           
static ReadStream openRead(java.io.Reader reader)
          Creates a ReadStream from a Reader
static ReadStream openRead(java.lang.String path)
          Create a ReadStream from a string.
static ReadWritePair openReadWrite(java.io.InputStream is, java.io.OutputStream os)
           
static ReadStream openString(java.lang.String string)
           
static WriteStream openWrite(CharBuffer cb)
          Creates a write stream to a CharBuffer.
static WriteStream openWrite(java.io.OutputStream os)
           
static WriteStream openWrite(java.lang.String path)
           
static WriteStream openWrite(java.io.Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lookup

public static Path lookup(java.lang.String url)
Returns a new path relative to the current directory.
Parameters:
url - a relative or absolute url
Returns:
the new path.

lookup

public static Path lookup()
Returns a path for the current directory.

lookup

public static Path lookup(java.lang.String url,
                          java.util.Map attr)
Returns a new path, including attributes.

For example, an application may want to set locale headers for an HTTP request.

Parameters:
url - the relative url
attr - attributes used in searching for the url

lookupNative

public static Path lookupNative(java.lang.String url)
Returns a path using the native filesystem conventions.

For example, on windows

 Path path = Pwd.lookup("d:\\temp\\test.html");
 
Parameters:
url - a relative path using the native filesystem conventions.

lookupNative

public static Path lookupNative(java.lang.String url,
                                java.util.Map attr)
Returns a native filesystem path with attributes.
Parameters:
url - a relative path using the native filesystem conventions.
attr - attributes used in searching for the url

openReadWrite

public static ReadWritePair openReadWrite(java.io.InputStream is,
                                          java.io.OutputStream os)

openRead

public static ReadStream openRead(java.io.InputStream is)
Creates new ReadStream from an InputStream

openRead

public static ReadStream openRead(java.io.InputStream is,
                                  WriteStream ws)

openRead

public static ReadStream openRead(java.io.Reader reader)
Creates a ReadStream from a Reader

openRead

public static ReadStream openRead(java.lang.String path)
                           throws java.io.IOException
Create a ReadStream from a string. utf-8 is used as the encoding

openString

public static ReadStream openString(java.lang.String string)

openWrite

public static WriteStream openWrite(java.io.OutputStream os)

openWrite

public static WriteStream openWrite(java.io.Writer writer)

openWrite

public static WriteStream openWrite(CharBuffer cb)
Creates a write stream to a CharBuffer. This is the standard way to write to a string.

openWrite

public static WriteStream openWrite(java.lang.String path)
                             throws java.io.IOException

openAppend

public static WriteStream openAppend(java.lang.String path)
                              throws java.io.IOException