org.apache.derby.impl.store.replication.net
Class SocketConnection
- java.lang.Object
-
- org.apache.derby.impl.store.replication.net.SocketConnection
-
public class SocketConnection extends java.lang.ObjectThis class encapsulates aSocketconnection and has methods that allow to read and write into the Object streams created from this connection.
-
-
Constructor Summary
Constructors Constructor and Description SocketConnection(java.net.Socket socket)Constructor creates the streams from the socket object passed as parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.lang.ObjectreadMessage()Used to read the object messages that are sent.voidtearDown()Closes theSocketand the object streams obtained from it.voidwriteMessage(java.lang.Object message)Used to send the object messages across the socket conection.
-
-
-
Constructor Detail
-
SocketConnection
public SocketConnection(java.net.Socket socket) throws java.io.IOExceptionConstructor creates the streams from the socket object passed as parameter.- Parameters:
socket- theSocketobject that this class encapsulates.- Throws:
java.io.IOException- If an exception occurs while creating the streams from the socket object.
-
-
Method Detail
-
readMessage
public java.lang.Object readMessage() throws java.lang.ClassNotFoundException, java.io.IOExceptionUsed to read the object messages that are sent. waits on the input stream until a data is present that can be read and returns this data.- Returns:
- the data read from the connection.
- Throws:
java.lang.ClassNotFoundException- Class of a serialized object cannot be found.java.io.IOException- if an exception occurs while reading from the stream.
-
writeMessage
public void writeMessage(java.lang.Object message) throws java.io.IOExceptionUsed to send the object messages across the socket conection.- Parameters:
message- the data to be written into the connection.- Throws:
java.io.IOException- if an exception occurs while writing into the stream.
-
tearDown
public void tearDown() throws java.io.IOExceptionCloses theSocketand the object streams obtained from it.- Throws:
java.io.IOException- if an exception occurs while trying to close the socket or the streams.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG