: Class MuxInputStream

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.www.mux
Class MuxInputStream

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

public class MuxInputStream
extends java.io.InputStream
implements MUX

Field Summary
`protected int` | `avail_credit` Current available credit on that session.
`protected byte[]` | `buffer` This input stream associated buffer.
`protected int` | `buflen` The current buffer length.
`protected int` | `bufptr` The current buffer position.
`protected boolean` | `closed` Has this stream been closed ?
`protected int` | `consumed_credit` Currently consumed credits.
`protected java.lang.String` | `errmsg` Error message in case of error.
`protected int` | `markptr` The current mark within the input buffer, or -1.
`protected boolean` | `pushpending` Yet another push is pending from the reader thread.
`protected MuxSession` | `session` The MuxSession instance this input stream is attached to.
`protected org.w3c.www.mux.MuxWriter` | `writer` A quick reference to that session writer.

Fields inherited from interface org.w3c.www.mux.MUX
`CONTROL, CTRL_CODE, CTRL_DEFINE_STACK, CTRL_DEFINE_STRING, CTRL_MUX_CONTROL, CTRL_SEND_CREDIT, FIN, LENGTH, LONG_LENGTH, MAX_SESSION, PUSH, READER_BUFFER_SIZE, RECEIVER_DEFAULT_CREDIT, RST, SENDER_DEFAULT_CREDIT, SENDER_DEFAULT_FRAGMENT_SIZE, SESSION, SESSIONS_INCR, SYN, WRITER_BUFFER_SIZE`

Constructor Summary
`protected` | `MuxInputStream(MuxSession session)` Create an input stream to read data from the given session.

Method Summary
`int` | `available()` Get the number of available bytes on that stream.
`void` | `close()` Close that input stream.
`protected void` | `error(java.lang.String msg)` Notify that stream of some error condition.
`void` | `mark(int readlimit)` Set a mark in that input stream.
`protected void` | `push(byte[] data, int off, int len, boolean noflush)` Fill in that input stream with more data.
`int` | `read()` Read one byte of input from the stream.
`int` | `read(byte[] b, int off, int len)` Reads into an array of bytes.
`void` | `reset()` Reset buffer to last mark.

Methods inherited from class java.io.InputStream
`markSupported, read, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### session

    protected MuxSession session

  The MuxSession instance this input stream is attached to.

### writer

    protected org.w3c.www.mux.MuxWriter writer

  A quick reference to that session writer.

### buffer

    protected byte[] buffer

  This input stream associated buffer.

### bufptr

    protected int bufptr

  The current buffer position.

### markptr

    protected int markptr

  The current mark within the input buffer, or -1.

### buflen

    protected int buflen

  The current buffer length.

### closed

    protected boolean closed

  Has this stream been closed ?

### consumed_credit

    protected int consumed_credit

  Currently consumed credits.

### avail_credit

    protected int avail_credit

  Current available credit on that session.

### pushpending

    protected boolean pushpending

  Yet another push is pending from the reader thread.

### errmsg

    protected java.lang.String errmsg

  Error message in case of error.

Constructor Detail

### MuxInputStream

    protected MuxInputStream(MuxSession session)

  Create an input stream to read data from the given session.
  Parameters:
    `session` - The session to read data from.

Method Detail

### push

    protected void push(byte[] data,
                        int off,
                        int len,
                        boolean noflush)
                 throws java.io.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.

### mark

    public void mark(int readlimit)

  Set a mark in that input stream.
  Overrides:
    mark in class java.io.InputStream
  Parameters:
    `readlimit` - The maximum limit of bytes allowed to be read before the mark becomes invalid.

### reset

    public void reset()
               throws java.io.IOException

  Reset buffer to last mark.
  Overrides:
    reset in class java.io.InputStream
  Throws:
    java.io.IOException - If the mark has not been set, or if it is no longer valid.

### error

    protected void error(java.lang.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.

### available

    public int available()
                  throws java.io.IOException

  Get the number of available bytes on that stream.
  Overrides:
    available in class java.io.InputStream
  Returns:
    Number of bytes available.

### close

    public void close()
               throws java.io.IOException

  Close that input stream.
  Overrides:
    close in class java.io.InputStream
  Throws:
    java.io.IOException - If some IO error occured during close.

### read

    public int read()
             throws java.io.IOException

  Read one byte of input from the stream.
  Overrides:
    read in class java.io.InputStream
  Returns:
    The byte read, or -1 if end of stream.
  Throws:
    java.io.IOException - If an IO error has occured.

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Reads into an array of bytes. This method will block until some input is available.
  Overrides:
    read in class java.io.InputStream
  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:
    java.io.IOException - If an I/O error has occurred.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD