org.sapia.ubik.net.mplex
Class MultiplexSocket

java.lang.Object
  extended by java.net.Socket
      extended by org.sapia.ubik.net.mplex.MultiplexSocket

public class MultiplexSocket
extends java.net.Socket

The MultiplesSocket is the implementation of client socket that is used in Ubik's multiplex logic. It extends the traditionnal Socket of the java.net package to add a read-ahead functionality on the input stream of the socket.

This class has the following limitation were a maximum number of bytes that can be read in advanced and put back in the input stream of the socket has to be set when creating a new MultiplexSocket instance.

Author:
Jean-Cedric Desrochers
Copyright:
Copyright © 2002-2004 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
MultiplexSocket(java.net.SocketImpl impl, int bufferSize)
          Creates a new MultiplexSocket instance.
 
Method Summary
 java.io.InputStream getInputStream()
          Returns the input stream of this socket.
 java.io.PushbackInputStream getPushbackInputStream()
          Returns the input stream of this socket as a PushbackInputStream.
 java.lang.String toString()
          Returns the implementation address and implementation port of this socket as a String.
 
Methods inherited from class java.net.Socket
bind, close, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiplexSocket

public MultiplexSocket(java.net.SocketImpl impl,
                       int bufferSize)
                throws java.net.SocketException
Creates a new MultiplexSocket instance. The socket will not be connected.

Parameters:
impl - The socket impl to use.
bufferSize - The maximum read-ahead buffer size.
Throws:
java.net.SocketException - If an error occurs with the socket impl.
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the input stream of this socket.

Overrides:
getInputStream in class java.net.Socket
Returns:
The input stream of this socket.
Throws:
java.io.IOException - If an I/O error occurs when creating the input stream, the socket is closed, the socket is not connected, or the socket input has been shutdown using Socket.shutdownInput().

getPushbackInputStream

public java.io.PushbackInputStream getPushbackInputStream()
                                                   throws java.io.IOException
Returns the input stream of this socket as a PushbackInputStream.

Returns:
The input stream of this socket as a PushbackInputStream.
Throws:
java.io.IOException

toString

public java.lang.String toString()
Returns the implementation address and implementation port of this socket as a String.

Overrides:
toString in class java.net.Socket
Returns:
A string representation of this socket.


Copyright © 2010 Sapia OSS. All Rights Reserved.