com.caucho.vfs |
Resin's Virtual File System. Resin's VFS combines and simplifies the morass
in Java I/O. The core classes are:
Path -- API similar to File, but supports URLs as well as
paths.
ReadStream -- buffered read stream handing both
byte and character input
WriteStream -- buffered write stream handling both
byte and character output
Virtual Paths
Path access is based on standard URLs. The following URL schemes are
predefined.
- file: -- the standard filesystem
- http: -- the http filesystem
- mailto: -- sending mail
- stdout: -- standard output (System.out)
- stderr: -- standard error (System.err)
- tcp: -- TCP socket pair
- null: -- /dev/null
- log: -- debug logging (controlled by resin.conf)
Reading a File
ReadStream implements InputStream so it can be
used wherever an InputStream is appropriate.
The Vfs facade is convenient for opening files.
ReadStream rs = Vfs.openRead("http://www.yahoo.com");
int ch;
while ((ch = rs.read()) >= 0)
System.out.print((char) ch);
Writing a File
WriteStream implements OutputStream so it can be
used wherever an OutputStream is appropriate. It also implements
the familiar print() methods from PrintStream ,
although they do throw IOExceptions.
The Vfs facade is convenient for opening files.
WriteStream ws = Vfs.openWrite("mailto:user@foo.com");
ws.setAttribute("subject", "hi, there");
ws.println("Just a little hello, world message");
ws.close();
|
Java Source File Name | Type | Comment |
AbstractByteToChar.java | Class | Utility class for converting a byte stream to a character stream. |
AbstractPrintWriter.java | Class | An abstract print writer. |
BasicDependencyContainer.java | Class | Contains a set of dependencies. |
BindPath.java | Class | |
BufferedReaderAdapter.java | Class | Trivial adapter so readers and input streams can be used in the
same servlet. |
ByteToChar.java | Class | Utility class for converting a byte stream to a character stream. |
ByteToCharWriter.java | Class | Utility class for converting a byte stream to a character stream. |
ClientDisconnectException.java | Class | Exception thrown when a client unexpectedly closes a connection. |
ConstPath.java | Class | |
ContextLoaderObjectInputStream.java | Class | Object input stream which loads based on the context class loader. |
Crc64Stream.java | Class | |
Depend.java | Class | Class for keeping track of modifications. |
Dependency.java | Interface | Interface representing a resource that might change. |
EnclosedWriteStream.java | Interface | |
Encoding.java | Class | Converts between the mime encoding names and Java encoding names. |
FilePath.java | Class | FilePath implements the native filesystem. |
FileRandomAccessStream.java | Class | Reads from a file in a random-access fashion. |
FileReadStream.java | Class | |
FileStatus.java | Class | |
FilesystemPath.java | Class | Abstract FilesystemPath, the parent of hierarchical Paths like
FilePath or HttpPath. |
FileWriteStream.java | Class | |
FlushBuffer.java | Interface | Interface if a writer supports the flushBuffer(). |
HttpPath.java | Class | The HTTP scheme. |
HttpsPath.java | Class | The HTTP scheme. |
HttpStream.java | Class | Underlying stream handling HTTP requests. |
HttpStreamWrapper.java | Class | Facade to HttpStream to properly handle the close. |
IOExceptionWrapper.java | Class | |
IOTimeoutException.java | Class | |
JndiPath.java | Class | Adapts the JNDI to the Path API. |
LockableStream.java | Interface | |
MemoryStream.java | Class | |
MultipartStream.java | Class | |
NotFoundPath.java | Class | Always returns FileNotFound for any open attempt. |
NullPath.java | Class | |
NullWriteStream.java | Class | A WriteStream that writes to nothing. |
OldByteToChar.java | Class | Utility class for converting a byte stream to a character stream. |
OutputStreamWithBuffer.java | Class | An OutputStream with an accessible buffer. |
Path.java | Class | A virtual filesystem path, essentially represented by a URL.
Its API resembles a combination of the JDK File object and the URL object.
Paths are, in general, given with the canonical file separator of
forward slash, '/'. |
PathWrapper.java | Class | Wraps a path object. |
PersistentDependency.java | Interface | Interface representing a resource that might change. |
PipeStream.java | Class | Stream allowing two threads to read and write to each other. |
PrintWriterImpl.java | Class | A print writer which allows for a changing writer. |
QServerSocket.java | Class | Abstract socket to handle both normal sockets and bin/resin sockets. |
QSocket.java | Class | Abstract socket to handle both normal sockets and JNI sockets. |
RandomAccessStream.java | Class | Reads from a file in a random-access fashion. |
ReaderStream.java | Class | |
ReaderWriterStream.java | Class | |
ReadStream.java | Class | A fast bufferered input stream supporting both character
and byte data. |
ReadWritePair.java | Class | |
SchemeMap.java | Class | The top-level filesystem schemes are collected into a single map.
The default scheme has a number of standard filesystems, file:, mailto:,
jndi:, http:.
Applications can add schemes in the configuration file. |
SocketStream.java | Class | Specialized stream to handle sockets. |
SpyRandomAccessStream.java | Class | Reads from a file in a random-access fashion. |
StderrStream.java | Class | Stream encapsulating System.err. |
StdoutStream.java | Class | Stream encapsulating System.out. |
StreamFilter.java | Class | |
StreamImpl.java | Class | This is the service provider's interface for a stream supported by
the VFS. |
StreamImplInputStream.java | Class | |
StreamImplOutputStream.java | Class | Unbuffered output stream to the stream impl
the VFS. |
StreamPrintWriter.java | Class | A print writer which writes to a specific WriteStream. |
StringPath.java | Class | |
StringReader.java | Class | A stream reading data from a string. |
StringStream.java | Class | |
StringWriter.java | Class | |
Syslog.java | Class | Stream which writes to syslog. |
TcpPath.java | Class | Implements a tcp stream, essentially just a socket pair. |
TcpsPath.java | Class | Implements a tcp stream, essentially just a socket pair. |
TcpStream.java | Class | Implementation of a TCP stream. |
TempBuffer.java | Class | Pooled temporary byte buffer. |
TempCharBuffer.java | Class | |
TempCharReader.java | Class | Char reader based on an underlying buffer. |
TempCharStream.java | Class | |
TempFile.java | Class | |
TempOutputStream.java | Class | |
TempReadStream.java | Class | |
TempStream.java | Class | |
Utf16RevReader.java | Class | |
VfsStream.java | Class | Stream encapsulating InputStream/OutputStream. |
VfsWriteObject.java | Interface | |
WriterStreamImpl.java | Class | Handles a stream which outputs to a writer. |
WriteStream.java | Class | A fast bufferered output stream supporting both character
and byte data. |
XmlWriter.java | Class | |