All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.www.mux.MuxInputStream

java.lang.Object
   |
   +----java.io.InputStream
           |
           +----w3c.www.mux.MuxInputStream

public class MuxInputStream
extends InputStream
implements MUX

Variable Index

 o avail_credit
Current available credit on that session.
 o buffer
This input stream associated buffer.
 o buflen
The current buffer length.
 o bufptr
The current buffer position.
 o closed
Has this stream been closed ?
 o consumed_credit
Currently consumed credits.
 o errmsg
Error message in case of error.
 o markptr
The current mark within the input buffer, or -1.
 o pushpending
Yet another push is pending from the reader thread.
 o session
The MuxSession instance this input stream is attached to.
 o writer
A quick reference to that session writer.

Constructor Index

 o MuxInputStream(MuxSession)
Create an input stream to read data from the given session.

Method Index

 o available()
Get the number of available bytes on that stream.
 o close()
Close that input stream.
 o error(String)
Notify that stream of some error condition.
 o mark(int)
Set a mark in that input stream.
 o push(byte[], int, int, boolean)
Fill in that input stream with more data.
 o read()
Read one byte of input from the stream.
 o read(byte[], int, int)
Reads into an array of bytes.
 o reset()
Reset buffer to last mark.

Variables

 o session
 protected MuxSession session
The MuxSession instance this input stream is attached to.

 o writer
 protected MuxWriter writer
A quick reference to that session writer.

 o buffer
 protected byte buffer[]
This input stream associated buffer.

 o bufptr
 protected int bufptr
The current buffer position.

 o markptr
 protected int markptr
The current mark within the input buffer, or -1.

 o buflen
 protected int buflen
The current buffer length.

 o closed
 protected boolean closed
Has this stream been closed ?

 o consumed_credit
 protected int consumed_credit
Currently consumed credits.

 o avail_credit
 protected int avail_credit
Current available credit on that session.

 o pushpending
 protected boolean pushpending
Yet another push is pending from the reader thread.

 o errmsg
 protected String errmsg
Error message in case of error.

Constructors

 o MuxInputStream
 protected MuxInputStream(MuxSession session)
Create an input stream to read data from the given session.

Parameters:
session - The session to read data from.

Methods

 o push
 protected synchronized void push(byte data[],
                                  int off,
                                  int len,
                                  boolean noflush) throws IOException
Fill in that input stream with more data. This method can only be called from within that package, typically by the session reader, to fill in the buffer.

Parameters:
data - The data read from the socket.
off - Offset of available data within above buffer.
len - Length of available data within above buffer.
noflush - Set to true if there is already more data available for that session.
 o mark
 public synchronized void mark(int readlimit)
Set a mark in that input stream.

Parameters:
readlimit - The maximum limit of bytes allowed to be read before the mark becomes invalid.
Overrides:
mark in class InputStream
 o reset
 public synchronized void reset() throws IOException
Reset buffer to last mark.

Throws: IOException
If the mark has not been set, or if it is no longer valid.
Overrides:
reset in class InputStream
 o error
 protected synchronized void error(String msg)
Notify that stream of some error condition. When an error condition is detected, all read accesses to the stream will result in an IOException being thrown, with as a message, the message provided here.

Parameters:
msg - Error message to be provided in any future IOException.
 o available
 public synchronized int available() throws IOException
Get the number of available bytes on that stream.

Returns:
Number of bytes available.
Overrides:
available in class InputStream
 o close
 public synchronized void close() throws IOException
Close that input stream.

Throws: IOException
If some IO error occured during close.
Overrides:
close in class InputStream
 o read
 public synchronized int read() throws IOException
Read one byte of input from the stream.

Returns:
The byte read, or -1 if end of stream.
Throws: IOException
If an IO error has occured.
Overrides:
read in class InputStream
 o read
 public synchronized int read(byte b[],
                              int off,
                              int len) throws IOException
Reads into an array of bytes. This method will block until some input is available.

Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws: IOException
If an I/O error has occurred.
Overrides:
read in class InputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index