org.w3c.www.mux
Class MuxSession

java.lang.Object
  extended by org.w3c.www.mux.MuxSession

public class MuxSession
extends java.lang.Object


Field Summary
protected  boolean aborted
          Has this session been aborted ?
protected  boolean finsent
          Has this session emitted a FIN (is it half-closed ?)
protected  int id
          This session's identifier.
protected  MuxInputStream in
          The session's input stream.
static int INPUT_BUFFER_SIZE
          The default input buffer size for all sessions.
protected  MuxOutputStream out
          The session's output stream.
protected  int protid
          This session's protocol identifier.
protected  MuxStream stream
          The stream to which that session belongs.
 
Constructor Summary
protected MuxSession(MuxStream stream, int id, int protid)
           
 
Method Summary
protected  void abort()
          Abort that session.
 int getIdentifier()
          Get this session identifier.
 java.net.InetAddress getInetAddress()
          Get the other end's IP address.
protected  int getInputBufferSize()
          Get this session's input stream buffer size.
 java.io.InputStream getInputStream()
          Get this session's input stream.
protected  MuxStream getMuxStream()
          Get the Mux stream to which that session is attached.
 java.io.OutputStream getOutputStream()
          Get this session's output stream.
 int getProtocolIdentifier()
          Get this session protocol identifier.
protected  void notifyControl(int fragsz)
           
protected  void notifyCredit(int credit)
           
protected  void notifyFIN()
          We have received a FIN on that session's output stream.
protected  void notifyOutputClose()
           
protected  void notifyPUSH()
           
protected  void notifyRST()
          The other end is telling us that something is going wrong.
protected  void pushInput(byte[] data, int off, int len, boolean noflush)
          Push some data into that session's input stream.
protected  void sendFIN()
          Send a FIN message on that session.
 void shutdown()
          Shutdown that session gracefully.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INPUT_BUFFER_SIZE

public static final int INPUT_BUFFER_SIZE
The default input buffer size for all sessions.

See Also:
Constant Field Values

stream

protected MuxStream stream
The stream to which that session belongs.


in

protected MuxInputStream in
The session's input stream.


out

protected MuxOutputStream out
The session's output stream.


id

protected int id
This session's identifier.


protid

protected int protid
This session's protocol identifier.


aborted

protected boolean aborted
Has this session been aborted ?


finsent

protected boolean finsent
Has this session emitted a FIN (is it half-closed ?)

Constructor Detail

MuxSession

protected MuxSession(MuxStream stream,
                     int id,
                     int protid)
Method Detail

pushInput

protected final void pushInput(byte[] data,
                               int off,
                               int len,
                               boolean noflush)
                        throws java.io.IOException
Push some data into that session's input stream.

Parameters:
data - The buffer containing the data to be pushed.
off - Offset of the data within above buffer.
len - Length of data to be pushed.
noflush - Set to true if there is already more data available for that session.
Throws:
java.io.IOException - If IO was interrupted.

sendFIN

protected final void sendFIN()
                      throws java.io.IOException
Send a FIN message on that session.

Throws:
java.io.IOException

notifyFIN

protected final void notifyFIN()
                        throws java.io.IOException
We have received a FIN on that session's output stream.

Throws:
java.io.IOException - If some IO error occured.

notifyRST

protected void notifyRST()
                  throws java.io.IOException
The other end is telling us that something is going wrong. Cleanup.

Throws:
java.io.IOException

notifyPUSH

protected void notifyPUSH()

notifyCredit

protected final void notifyCredit(int credit)

notifyControl

protected final void notifyControl(int fragsz)

notifyOutputClose

protected void notifyOutputClose()
                          throws java.io.IOException
Throws:
java.io.IOException

abort

protected void abort()
Abort that session. The MUX stream erred, the underlying transport streams are broken. Terminate that session, make sure any further action on it will trigger an IO error.


shutdown

public void shutdown()
              throws java.io.IOException
Shutdown that session gracefully.

Throws:
java.io.IOException

getMuxStream

protected final MuxStream getMuxStream()
Get the Mux stream to which that session is attached.

Returns:
A MuxStream instance.

getInputBufferSize

protected int getInputBufferSize()
Get this session's input stream buffer size.

Returns:
The standard buffer size for that session input stream.

getInetAddress

public java.net.InetAddress getInetAddress()
Get the other end's IP address.

Returns:
An InetAddress instance.

getIdentifier

public final int getIdentifier()
Get this session identifier.

Returns:
An integer identifier for that session.

getProtocolIdentifier

public final int getProtocolIdentifier()
Get this session protocol identifier.

Returns:
An integer identifying the protocol runnin on that session.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Get this session's input stream.

Returns:
An InputStream instance.
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Get this session's output stream.

Returns:
An OutputStream instance.
Throws:
java.io.IOException