org.w3c.www.mux
Class MuxOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.w3c.www.mux.MuxOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class MuxOutputStream
extends java.io.OutputStream


Field Summary
protected  int avail_credit
          The currently available credit.
protected  boolean closed
          Has this stream been closed ?
protected static boolean debug
           
protected  int fragsz
          The current max allowed fragment size.
protected  int sessid
          The identifier of above session (fast access).
protected  MuxSession session
          The session this stream is attached to.
protected  org.w3c.www.mux.MuxWriter writer
          The writer instance for the multiplexed stream.
 
Constructor Summary
protected MuxOutputStream(MuxSession session)
           
 
Method Summary
 void close()
          Close that session output stream.
 void flush()
          Flush that output stream, blocking all data has been sent.
protected  void notifyControl(int control)
          Callback notifying the the frgament size has changed.
protected  void notifyCredit(int credit)
          Callback notifying that more credit is available for that stream.
 void write(byte[] b, int off, int len)
          Writes a sub array of bytes.
 void write(int b)
          Writes a byte.
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static final boolean debug
See Also:
Constant Field Values

session

protected MuxSession session
The session this stream is attached to.


sessid

protected int sessid
The identifier of above session (fast access).


writer

protected org.w3c.www.mux.MuxWriter writer
The writer instance for the multiplexed stream.


fragsz

protected int fragsz
The current max allowed fragment size.


avail_credit

protected int avail_credit
The currently available credit.


closed

protected boolean closed
Has this stream been closed ?

Constructor Detail

MuxOutputStream

protected MuxOutputStream(MuxSession session)
Method Detail

notifyCredit

protected void notifyCredit(int credit)
Callback notifying that more credit is available for that stream.

Parameters:
credit - The credit we are getting from our peer.

notifyControl

protected void notifyControl(int control)
Callback notifying the the frgament size has changed.

Parameters:
control - The new fragment size.

write

public void write(int b)
           throws java.io.IOException
Writes a byte. This method will block until the byte is actually written. It is highly recomended that you use a buffered output stream on top of that stream, or that you don't use that method.

Specified by:
write in class java.io.OutputStream
Parameters:
b - the byte
Throws:
java.io.IOException - If an I/O error has occurred.

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes a sub array of bytes.

Overrides:
write in class java.io.OutputStream
Parameters:
b - the data to be written
off - the start offset in the data
len - the number of bytes that are written
Throws:
java.io.IOException - If an I/O error has occurred.

flush

public void flush()
           throws java.io.IOException
Flush that output stream, blocking all data has been sent.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - If some IO errors occur.

close

public void close()
           throws java.io.IOException
Close that session output stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - If some IO errors occur.