electric.net.socket
Class SocketChannel

java.lang.Object
  extended byelectric.net.socket.SocketChannel
All Implemented Interfaces:
IChannel

public class SocketChannel
extends java.lang.Object
implements IChannel

SocketChannel is an IChannel that represents a socket connection.

Author:
webMethods

Constructor Summary
SocketChannel(java.net.Socket socket, java.lang.String protocol)
           
SocketChannel(java.net.Socket socket, java.lang.String protocol, IChannelListener shutdownListener)
           
 
Method Summary
 void close()
          Close the channel.
 long getBytesRead()
          Return the number of bytes read by this channel or -1 if the information is not collected
 long getBytesWritten()
          Return the number of bytes written by this channel or -1 of the information is not collected
static int getDefaultBufferSize()
           
static int getDefaultTimeout()
           
 java.io.InputStream getInputStream()
          Return the input stream.
 boolean getKeepAlive()
           
 boolean getKeptAlive()
           
 XURL getLocalXURL()
          Return the URL of the local endpoint.
 java.io.OutputStream getOutputStream()
          Return the output stream.
 XURL getRemoteXURL()
          Return the URL of the remote endpoint.
 java.net.Socket getSocket()
          Return the socket underlying this channel.
 int getState()
          Return state of the channel.
 int getTimeout()
           
static void needInstrumentation(boolean instrumentChannel)
           
static void setDefaultBufferSize(int bufferSize)
           
static void setDefaultTimeout(int milliseconds)
           
 void setKeepAlive(boolean keepAlive)
           
 void setKeptAlive(boolean keptAlive)
           
 void setState(int state)
          Change the state of the channel.
 void setTimeout(int milliseconds)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketChannel

public SocketChannel(java.net.Socket socket,
                     java.lang.String protocol)
              throws java.io.IOException
Parameters:
socket -
protocol -
Throws:
java.io.IOException

SocketChannel

public SocketChannel(java.net.Socket socket,
                     java.lang.String protocol,
                     IChannelListener shutdownListener)
              throws java.io.IOException
Parameters:
socket -
protocol -
shutdownListener -
Throws:
java.io.IOException
Method Detail

toString

public java.lang.String toString()

getSocket

public java.net.Socket getSocket()
Return the socket underlying this channel. Most access should be throught he higher-level SocketChannel methods, but direct access to the socket is necessary for determinging SSL parameters, etc.

Returns:
the socket underlying this channel.
See Also:
WebServer, SSLMessageFactory

setTimeout

public void setTimeout(int milliseconds)
                throws java.io.IOException
Parameters:
milliseconds - new socket timeout
Throws:
java.io.IOException

getTimeout

public int getTimeout()
               throws java.io.IOException
Returns:
socket timeout
Throws:
java.io.IOException - if socket closed

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: IChannel
Return the input stream.

Specified by:
getInputStream in interface IChannel
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from interface: IChannel
Return the output stream.

Specified by:
getOutputStream in interface IChannel
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from interface: IChannel
Close the channel.

Specified by:
close in interface IChannel
Throws:
java.io.IOException

getLocalXURL

public XURL getLocalXURL()
Description copied from interface: IChannel
Return the URL of the local endpoint.

Specified by:
getLocalXURL in interface IChannel

getRemoteXURL

public XURL getRemoteXURL()
Description copied from interface: IChannel
Return the URL of the remote endpoint.

Specified by:
getRemoteXURL in interface IChannel

getBytesRead

public long getBytesRead()
Return the number of bytes read by this channel or -1 if the information is not collected

Specified by:
getBytesRead in interface IChannel

getBytesWritten

public long getBytesWritten()
Return the number of bytes written by this channel or -1 of the information is not collected

Specified by:
getBytesWritten in interface IChannel

setKeepAlive

public void setKeepAlive(boolean keepAlive)
Parameters:
keepAlive -

getKeepAlive

public boolean getKeepAlive()

setKeptAlive

public void setKeptAlive(boolean keptAlive)
Parameters:
keptAlive -

getKeptAlive

public boolean getKeptAlive()

setDefaultTimeout

public static void setDefaultTimeout(int milliseconds)
Parameters:
milliseconds - - the specified timeout in milliseconds

getDefaultTimeout

public static int getDefaultTimeout()

setDefaultBufferSize

public static void setDefaultBufferSize(int bufferSize)
Parameters:
bufferSize -

getDefaultBufferSize

public static int getDefaultBufferSize()

getState

public int getState()
Return state of the channel. The states are defined in IChannelStates

Specified by:
getState in interface IChannel

setState

public void setState(int state)
Change the state of the channel. The state passed into the method must be defined in IChannelStates.

Specified by:
setState in interface IChannel
Parameters:
state -

needInstrumentation

public static void needInstrumentation(boolean instrumentChannel)
Parameters:
instrumentChannel -


copyright© 2001-2004 by webMethods All Rights Reserved.