Class WebsaverInputStream
java.lang.Object
|
+----java.io.InputStream
|
+----WebsaverInputStream
- public class WebsaverInputStream
- extends InputStream
This is the low-level class used to read a stream of data off 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 ObjectInputStream or DataInputStream.
The opposite of this class is the WebsaverOutputStream.
- Author:
- Brad Fitzpatrick <bradfitz@bradfitz.com>
- See Also:
- WebsaverOutputStream, ObjectInputStream, DataInputStream
-
WebsaverInputStream(WebsaverConnection, String)
- Constructor for a WebsaverInputStream when the requested file was saved with
no password or w/ public-read access enabled.
-
WebsaverInputStream(WebsaverConnection, String, String)
- Constructor for a WebsaverInputStream when the requested file was saved with
a password required for reading.
-
available()
- Returns the number of bytes left in the stream.
-
close()
- Closes the connection and frees any resources associated with it.
-
read()
- Returns the next byte in the stream.
WebsaverInputStream
public WebsaverInputStream(WebsaverConnection wsConn,
String filename,
String password) throws IOException
- Constructor for a WebsaverInputStream when the requested file was saved with
a password required for reading.
- 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 to read this file, if needed. An exception will
be generated if you do not supply the correct password.
WebsaverInputStream
public WebsaverInputStream(WebsaverConnection wsConn,
String filename) throws IOException
- Constructor for a WebsaverInputStream when the requested file was saved with
no password or w/ public-read access enabled.
- 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.
available
public int available()
- Returns the number of bytes left in the stream.
- Returns:
- The number of bytes left in the stream, or 0 if the stream is empty.
- Overrides:
- available in class InputStream
read
public int read()
- Returns the next byte in the stream.
- Returns:
- The next byte in the stream, or -1 if the end is reached.
- Overrides:
- read in class InputStream
close
public void close()
- Closes the connection and frees any resources associated with it.
- Returns:
- None
- Overrides:
- close in class InputStream