All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class w3c.www.mux.MuxStream
java.lang.Object
   |
   +----w3c.www.mux.MuxStream
  -  public class MuxStream
  -  extends Object
   
  -   alive alive
-   Is this muxed stream still alive ?
  
-   handler handler
-   That stream accept handler.
  
-   in in
-   The raw input stream.
  
-   inetaddr inetaddr
-   Inet address of the other end's connection (maybe null)
  
-   out out
-   The raw output stream.
  
-   reader reader
-   This stream reader.
  
-   server server
-   Is this the server side of the MUX channel ?
  
-   sessions sessions
-   Currently defined sessions.
  
-   writer writer
-   This stream writer.
   
  -   MuxStream(boolean, MuxStreamHandler, InputStream, OutputStream) MuxStream(boolean, MuxStreamHandler, InputStream, OutputStream)
-  
  
-   MuxStream(boolean, MuxStreamHandler, Socket) MuxStream(boolean, MuxStreamHandler, Socket)
-  
   
  -   connect(int) connect(int)
-   Create a new MUX session, by connecting to the other end.
  
-   ctrlDefineStack(int, int[]) ctrlDefineStack(int, int[])
-   Handle the given DefineStack control message.
  
-   ctrlDefineString(int, String) ctrlDefineString(int, String)
-   Handle the given DefineString control message.
  
-   ctrlMuxControl(int, int) ctrlMuxControl(int, int)
-   Handle the given MuxControl control message.
  
-   ctrlSendCredit(int, int) ctrlSendCredit(int, int)
-   Handle the given SendCredit control message.
  
-   error(Object, Exception) error(Object, Exception)
-   A severe (fatal for that connection) errror has occured.
  
-   error(Object, String) error(Object, String)
-   A soft error has occured (eg socket close), Cleanup.
  
-   getInetAddress() getInetAddress()
-   Get the InetAddress associated with that MUX stream, if any.
  
-   getMuxWriter() getMuxWriter()
-   Get this stream MuxWriter object.
  
-   lookupSession(int, boolean) lookupSession(int, boolean)
-   Lookup for an already existing session having the given identifier.
  
-   lookupSession(int, int, int, int) lookupSession(int, int, int, int)
-   Handle that new incomming message.
  
-   shutdown(boolean) shutdown(boolean)
-   Shutdown this stream, and associated sessions gracefully.
  
-   unregisterSession(MuxSession) unregisterSession(MuxSession)
-   Unregiter the given session, it has been closed.
   
 handler
handler
 protected MuxStreamHandler handler
  -  That stream accept handler.
 
 reader
reader
 protected MuxReader reader
  -  This stream reader.
 
 writer
writer
 protected MuxWriter writer
  -  This stream writer.
 
 sessions
sessions
 protected MuxSession sessions[]
  -  Currently defined sessions.
 
 server
server
 protected boolean server
  -  Is this the server side of the MUX channel ?
 
 inetaddr
inetaddr
 protected InetAddress inetaddr
  -  Inet address of the other end's connection (maybe null)
 
 in
in
 protected InputStream in
  -  The raw input stream.
 
 out
out
 protected OutputStream out
  -  The raw output stream.
 
 alive
alive
 protected boolean alive
  -  Is this muxed stream still alive ?
 
   
 MuxStream
MuxStream
 public MuxStream(boolean server,
                  MuxStreamHandler handler,
                  InputStream in,
                  OutputStream out) throws IOException
 MuxStream
MuxStream
 public MuxStream(boolean server,
                  MuxStreamHandler handler,
                  Socket socket) throws IOException
   
 getMuxWriter
getMuxWriter
 protected final MuxWriter getMuxWriter()
  -  Get this stream MuxWriter object.
   
- 
    -  Returns:
    
-  A MuxWriter instance.
  
 
 error
error
 protected void error(Object obj,
                      Exception ex)
  -  A severe (fatal for that connection) errror has occured. Cleanup.
   
- 
    -  Parameters:
    
-  obj - The object that has generated the error.
    -  ex - The exception that triggered the error (or null
  null if this was a logical error).
  
 
 error
error
 protected synchronized void error(Object obj,
                                   String msg)
  -  A soft error has occured (eg socket close), Cleanup.
   
- 
    -  Parameters:
    
-  obj - The object that has detected the soft error.
    -  msg - An associated String message.
  
 
 ctrlDefineString
ctrlDefineString
 protected void ctrlDefineString(int strid,
                                 String str)
  -  Handle the given DefineString control message.
   
- 
    -  Parameters:
    
-  strid - The identifier for that String in the futur.
    -  str - This String being defined.
  
 
 ctrlDefineStack
ctrlDefineStack
 protected void ctrlDefineStack(int id,
                                int stack[]) throws IOException
  -  Handle the given DefineStack control message.
   
- 
    -  Parameters:
    
-  id - The identifier for that stack in the future.
    -  stack - The stack description (as an array of shorts).
  
 
 ctrlMuxControl
ctrlMuxControl
 protected void ctrlMuxControl(int sessid,
                               int fragsz) throws IOException
  -  Handle the given MuxControl control message.
   
- 
    -  Parameters:
    
-  sessid - The session to which that message applies.
    -  fragsz - The max allowed fragment size on that session.
  
 
 ctrlSendCredit
ctrlSendCredit
 protected void ctrlSendCredit(int sessid,
                               int credit) throws IOException
  -  Handle the given SendCredit control message.
   
- 
    -  Parameters:
    
-  sessid - The session to which that message applies.
    -  credit - The allowed credits.
  
 
 lookupSession
lookupSession
 protected MuxSession lookupSession(int flags,
                                    int sessid,
                                    int length,
                                    int llength) throws IOException
  -  Handle that new incomming message.
 This method is called by the reader of that session, to dispatch
 the message currently being read.
   
- 
    -  Returns:
    
-  A MuxSession instance to dispatch that message to, or
 null otherwise (ie a new session was rejected, etc).
 In that last case, it is up to the reader of that session to discard 
 any pending data.
  
 
 lookupSession
lookupSession
 protected synchronized MuxSession lookupSession(int sessid,
                                                 boolean check)
  -  Lookup for an already existing session having the given identifier.
   
- 
    -  Parameters:
    
-  sessid - The identifier of the session to look for.
    -  check - Is null a valid answer, if set and
 the requested session doesn't exist, a runtime exception is thrown.
    
-  Returns:
    
-  A MuxSession instance, or null if check is
 false and no session was found.
  
 
 unregisterSession
unregisterSession
 protected synchronized void unregisterSession(MuxSession session)
  -  Unregiter the given session, it has been closed.
   
- 
    -  Parameters:
    
-  session - The session to unregister.
  
 
 connect
connect
 public MuxSession connect(int protid) throws IOException
  -  Create a new MUX session, by connecting to the other end.
   
- 
    -  Parameters:
    
-  protid - The protocol that is going to be spoken on that new
 session.
    
-  Returns:
    
-  A connected MuxSession.
    
-  Throws: IOException
    
-  If the connection couldn't be set up properly.
  
 
 getInetAddress
getInetAddress
 public InetAddress getInetAddress()
  -  Get the InetAddress associated with that MUX stream, if any.
 MUX streams can run on any kind of Input/Output streams. This method
 will only return a non-null instance when possible.
   
- 
    -  Returns:
    
-  An InetAddress instance, or null if not
 available.
  
 
 shutdown
shutdown
 public synchronized boolean shutdown(boolean force) throws IOException
  -  Shutdown this stream, and associated sessions gracefully.
   
- 
    -  Parameters:
    
-  force - If true abort all existing sessions, and
 close the muxed streams physically. Otherwise, shutdown the muxed stream
 gracefully only if no more sessions are running.
    
-  Returns:
    
-  A boolean, true if shutdown was performed,
 false if it was not performed because force
 was false and some sessions were still running.
    
-  Throws: IOException
    
-  If some IO error occured.
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index