springs.util
Class SocketCountingBytes

java.lang.Object
  |
  +--java.net.Socket
        |
        +--springs.util.SocketCountingBytes

public class SocketCountingBytes
extends java.net.Socket

A socket with a count of the transmitted bytes.

Author:
Sergio Ilarri Artigas

Field Summary
private  java.io.FilterInputStream _is
           
private  java.io.FilterOutputStream _os
           
static int numReadBytes
           
static int numWrittenBytes
           
 
Fields inherited from class java.net.Socket
 
Constructor Summary
SocketCountingBytes()
          Constructor.
SocketCountingBytes(java.lang.String host, int port)
          Constructor.
 
Method Summary
 java.io.InputStream getInputStream()
          Returns a stream of the right type.
 java.io.OutputStream getOutputStream()
          Returns a stream of the right type.
static void increaseReadBytes(int increase)
          Increases safely the number of read bytes.
static void increaseWrittenBytes(int increase)
          Increases safely the number of written bytes.
 
Methods inherited from class java.net.Socket
bind, close, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numReadBytes

public static int numReadBytes

numWrittenBytes

public static int numWrittenBytes

_os

private java.io.FilterOutputStream _os

_is

private java.io.FilterInputStream _is
Constructor Detail

SocketCountingBytes

public SocketCountingBytes(java.lang.String host,
                           int port)
                    throws java.io.IOException
Constructor.

Parameters:
host - the host name.
port - the port number.
Throws:
java.io.IOException - if error
See Also:
String, IOException

SocketCountingBytes

public SocketCountingBytes()
                    throws java.io.IOException
Constructor.

Throws:
java.io.IOException - if error
See Also:
IOException
Method Detail

increaseReadBytes

public static void increaseReadBytes(int increase)
Increases safely the number of read bytes.

Parameters:
increase - the increase.

increaseWrittenBytes

public static void increaseWrittenBytes(int increase)
Increases safely the number of written bytes.

Parameters:
increase - the increase.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns a stream of the right type.

Overrides:
getInputStream in class java.net.Socket
Returns:
a stream of the right type.
java.io.IOException
See Also:
InputStream

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns a stream of the right type.

Overrides:
getOutputStream in class java.net.Socket
Returns:
a stream of the right type.
java.io.IOException
See Also:
OutputStream