com.caucho.v5.vfs.package.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of baratine Show documentation
Show all versions of baratine Show documentation
A reactive Java web server.
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:[email protected]");
ws.setAttribute("subject", "hi, there");
ws.println("Just a little hello, world message");
ws.close();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy