public class SocketConnection extends Object implements com.sun.star.connection.XConnection, com.sun.star.connection.XConnectionBroadcaster
XConnection interface
and is uses by the SocketConnector and the SocketAcceptor.
This class is not part of the provided api.
socketAcceptor,
socketConnector,
XConnection| Modifier and Type | Field and Description |
|---|---|
protected String |
_description |
protected boolean |
_firstRead |
protected InputStream |
_inputStream |
protected ArrayList<com.sun.star.io.XStreamListener> |
_listeners |
protected OutputStream |
_outputStream |
protected Socket |
_socket |
static boolean |
DEBUG
When set to true, enables various debugging output.
|
| Constructor and Description |
|---|
SocketConnection(String description,
Socket socket)
Constructs a new
SocketConnection. |
| Modifier and Type | Method and Description |
|---|---|
void |
addStreamListener(com.sun.star.io.XStreamListener aListener) |
void |
close()
Closes the connection.
|
void |
flush()
Flushes the buffer.
|
String |
getDescription()
Gives a description of the connection.
|
int |
read(byte[][] bytes,
int nBytesToRead)
Read the required number of bytes.
|
void |
removeStreamListener(com.sun.star.io.XStreamListener aListener) |
void |
write(byte[] aData)
Write bytes.
|
public static final boolean DEBUG
protected String _description
protected Socket _socket
protected InputStream _inputStream
protected OutputStream _outputStream
protected ArrayList<com.sun.star.io.XStreamListener> _listeners
protected boolean _firstRead
public SocketConnection(String description, Socket socket) throws IOException
SocketConnection.description - the description of the connection.socket - the socket of the connection.IOExceptionpublic void addStreamListener(com.sun.star.io.XStreamListener aListener)
throws com.sun.star.uno.RuntimeException
addStreamListener in interface com.sun.star.connection.XConnectionBroadcastercom.sun.star.uno.RuntimeExceptionpublic void removeStreamListener(com.sun.star.io.XStreamListener aListener)
throws com.sun.star.uno.RuntimeException
removeStreamListener in interface com.sun.star.connection.XConnectionBroadcastercom.sun.star.uno.RuntimeExceptionpublic int read(byte[][] bytes,
int nBytesToRead)
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
read in interface com.sun.star.connection.XConnectionbytes - the outparameter, where the bytes have to be placed.nBytesToRead - the number of bytes to read.com.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptionXConnection.read(byte[][], int)public void write(byte[] aData)
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
write in interface com.sun.star.connection.XConnectionaData - the bytes to write.com.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptionXConnection.write(byte[])public void flush()
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
flush in interface com.sun.star.connection.XConnectioncom.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptionXConnection.flush()public void close()
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
close in interface com.sun.star.connection.XConnectioncom.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptionXConnection.close()public String getDescription() throws com.sun.star.uno.RuntimeException
getDescription in interface com.sun.star.connection.XConnectioncom.sun.star.uno.RuntimeExceptionXConnection.getDescription()