public class TCPSocketWrapper extends java.lang.Object implements SocketWrapper
Constructor and Description |
---|
TCPSocketWrapper(java.net.Socket socket,
boolean isJavaObjectExpected)
General constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.net.InetAddress |
getInetAddress()
This method returns the address of the socket that is bound to this socket.
|
boolean |
isClosed()
This method returns true if the socket has been closed.
|
java.lang.Object |
readObject()
This method reads the object from the socket.
|
java.lang.Object |
readObject(int numberOfSeconds)
This method reads an object from the socket.
|
void |
writeObject(java.lang.Object obj)
This method sends an object through the socket.
|
public TCPSocketWrapper(java.net.Socket socket, boolean isJavaObjectExpected)
socket
- a Socket instanceisJavaObjectExpected
- a boolean.public java.lang.Object readObject() throws java.lang.Exception
SocketWrapper
readObject
in interface SocketWrapper
java.lang.Exception
public java.lang.Object readObject(int numberOfSeconds) throws java.lang.Exception
SocketWrapper
readObject
in interface SocketWrapper
numberOfSeconds
- number of seconds to wait before throwing a TimeoutExceptionjava.lang.Exception
public void writeObject(java.lang.Object obj) throws java.io.IOException
SocketWrapper
writeObject
in interface SocketWrapper
obj
- the object to be sent.java.io.IOException
public boolean isClosed()
SocketWrapper
isClosed
in interface SocketWrapper
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public java.net.InetAddress getInetAddress()
SocketWrapper
getInetAddress
in interface SocketWrapper