Package org.nustaq.net
Class TCPObjectSocket
java.lang.Object
org.nustaq.net.TCPObjectSocket
public class TCPObjectSocket
extends java.lang.Object
Created by ruedi on 22.08.14.
As socket allowing to send/receive serializable objects
see ./test/net for an example
Note that by providing a Json configuration, it can be used cross language
-
Field Summary
Fields Modifier and Type Field Description static intBUFFER_SIZE -
Constructor Summary
Constructors Constructor Description TCPObjectSocket(java.lang.String host, int port)TCPObjectSocket(java.lang.String host, int port, FSTConfiguration conf)TCPObjectSocket(java.net.Socket socket, FSTConfiguration conf) -
Method Summary
Modifier and Type Method Description voidclose()voidflush()FSTConfigurationgetConf()java.io.InputStreamgetIn()enables reading raw bytes from socketjava.lang.ThrowablegetLastError()java.net.SocketgetSocket()booleanisClosed()booleanisStopped()java.lang.ObjectreadObject()voidsetConf(FSTConfiguration conf)voidsetLastError(java.lang.Throwable ex)voidwriteObject(java.lang.Object toWrite)
-
Field Details
-
BUFFER_SIZE
public static int BUFFER_SIZE
-
-
Constructor Details
-
TCPObjectSocket
public TCPObjectSocket(java.lang.String host, int port) throws java.io.IOException- Throws:
java.io.IOException
-
TCPObjectSocket
public TCPObjectSocket(java.lang.String host, int port, FSTConfiguration conf) throws java.io.IOException- Throws:
java.io.IOException
-
TCPObjectSocket
- Throws:
java.io.IOException
-
-
Method Details
-
isStopped
public boolean isStopped() -
isClosed
public boolean isClosed() -
getIn
public java.io.InputStream getIn()enables reading raw bytes from socket- Returns:
-
readObject
public java.lang.Object readObject() throws java.lang.Exception- Throws:
java.lang.Exception
-
writeObject
public void writeObject(java.lang.Object toWrite) throws java.lang.Exception- Throws:
java.lang.Exception
-
flush
public void flush() throws java.io.IOException- Throws:
java.io.IOException
-
setLastError
public void setLastError(java.lang.Throwable ex) -
getLastError
public java.lang.Throwable getLastError() -
close
public void close() throws java.io.IOException- Throws:
java.io.IOException
-
getSocket
public java.net.Socket getSocket() -
getConf
-
setConf
-