org.tentackle.net
Class CompressedSocketWrapper

java.lang.Object
  extended by java.net.Socket
      extended by org.tentackle.net.SocketWrapper
          extended by org.tentackle.net.CompressedSocketWrapper

public class CompressedSocketWrapper
extends SocketWrapper

A compressed socket wrapper on top of another socket, usually an SSL-socket.

Author:
harald

Constructor Summary
CompressedSocketWrapper(Socket socket)
          Creates a compressed socket wrapper.
 
Method Summary
 void close()
          Closes this socket.
 InputStream getInputStream()
          Returns an input stream for this socket.
 OutputStream getOutputStream()
          Returns an output stream for this socket.
 
Methods inherited from class org.tentackle.net.SocketWrapper
bind, connect, equals, getChannel, hashCode, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown
 
Methods inherited from class java.net.Socket
connect, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompressedSocketWrapper

public CompressedSocketWrapper(Socket socket)
                        throws SocketException
Creates a compressed socket wrapper.

Parameters:
socket - the wrapped socket (for example a SSLSocket).
Throws:
SocketException
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Description copied from class: java.net.Socket
Returns an input stream for this socket.

If this socket has an associated channel then the resulting input stream delegates all of its operations to the channel. If the channel is in non-blocking mode then the input stream's read operations will throw an IllegalBlockingModeException.

Under abnormal conditions the underlying connection may be broken by the remote host or the network software (for example a connection reset in the case of TCP connections). When a broken connection is detected by the network software the following applies to the returned input stream :-

Closing the returned InputStream will close the associated socket.

Overrides:
getInputStream in class Socket
Returns:
an input stream for reading bytes from this socket.
Throws:
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()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Description copied from class: java.net.Socket
Returns an output stream for this socket.

If this socket has an associated channel then the resulting output stream delegates all of its operations to the channel. If the channel is in non-blocking mode then the output stream's write operations will throw an IllegalBlockingModeException.

Closing the returned OutputStream will close the associated socket.

Overrides:
getOutputStream in class Socket
Returns:
an output stream for writing bytes to this socket.
Throws:
IOException - if an I/O error occurs when creating the output stream or if the socket is not connected.

close

public void close()
           throws IOException
Description copied from class: java.net.Socket
Closes this socket.

Any thread currently blocked in an I/O operation upon this socket will throw a SocketException.

Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created.

Closing this socket will also close the socket's InputStream and OutputStream.

If this socket has an associated channel then the channel is closed as well.

Overrides:
close in class SocketWrapper
Throws:
IOException - if an I/O error occurs when closing this socket.
See Also:
Socket.isClosed()


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de