Class WebsaverOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----WebsaverOutputStream

public class WebsaverOutputStream
extends OutputStream
This is the low-level class used to write a stream of data into a file stored on the webserver. In reality, most people will not use this class directly, but will instead create it and use it to create an ObjectOutputStream or DataOutputStream.

The opposite of this class is the WebsaverInputStream.

Author:
Brad Fitzpatrick <bradfitz@bradfitz.com>
See Also:
WebsaverInputStream, ObjectOutputStream, DataOutputStream

Constructor Index

 o WebsaverOutputStream(WebsaverConnection, String)
Constructor for a WebsaverOutputStream for a new file without a password or for an existing file on the server that is not password protected.
 o WebsaverOutputStream(WebsaverConnection, String, String, boolean)
Constructor for a WebsaverOutputStream when the requested file was saved with a password required for writing, or to protect a new file w/ a password.

Method Index

 o close()
Important: The data written to the stream is only saved once the stream is closed.
 o write(int)
Writes the next byte to the stream.

Constructors

 o WebsaverOutputStream
 public WebsaverOutputStream(WebsaverConnection wsConn,
                             String filename,
                             String password,
                             boolean publicReadable)
Constructor for a WebsaverOutputStream when the requested file was saved with a password required for writing, or to protect a new file w/ a password.

Parameters:
wsConn - A previously created WebsaverConnection object, used to communicate with the server.
filename - The filename on the server to read from. Only alphanumerics, underscore, period, and hyphen are allowed in the filename.
password - The password required to write to this file, if the file exists, and also the password required to read this file if publicReadable is not true.
publicReadable - A boolean that was set, indicates users only need a password to overwrite this file, but they may read from it without a password.
 o WebsaverOutputStream
 public WebsaverOutputStream(WebsaverConnection wsConn,
                             String filename)
Constructor for a WebsaverOutputStream for a new file without a password or for an existing file on the server that is not password protected.

Parameters:
wsConn - A previously created WebsaverConnection object, used to communicate with the server.
filename - The filename on the server to read from. Only alphanumerics, underscore, period, and hyphen are allowed in the filename.
password - The password required to write to this file, if the file exists, and also the password required to read this file if publicReadable is not true.
publicReadable - A boolean that was set, indicates users only need a password to overwrite this file, but they may read from it without a password.

Methods

 o write
 public void write(int b)
Writes the next byte to the stream.

Returns:
None
Overrides:
write in class OutputStream
 o close
 public void close() throws IOException
Important: The data written to the stream is only saved once the stream is closed. Although close() should be automatically called when the object is about ready to go out of scope, it is best to call this method explicitly to ensure your data is saved. Calling close() on any higher-level output class that uses this class should be sufficient.

Returns:
None
Overrides:
close in class OutputStream