public class SocketConnection
extends java.lang.Object
XConnection interface
and is uses by the SocketConnector and the SocketAcceptor.
This class is not part of the provided api.
com.sun.star.comp.connections.SocketAcceptor,
com.sun.star.comp.connections.SocketConnector,
com.sun.star.connections.XConnection| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
_description |
protected boolean |
_firstRead |
protected java.io.InputStream |
_inputStream |
protected java.util.Vector |
_listeners |
protected java.io.OutputStream |
_outputStream |
protected java.net.Socket |
_socket |
static boolean |
DEBUG
When set to true, enables various debugging output.
|
| Constructor and Description |
|---|
SocketConnection(java.lang.String description,
java.net.Socket socket)
Constructs a new
SocketConnection. |
| Modifier and Type | Method and Description |
|---|---|
void |
addStreamListener(XStreamListener aListener) |
void |
close()
Closes the connection.
|
void |
flush()
Flushes the buffer.
|
java.lang.String |
getDescription()
Gives a description of the connection.
|
int |
read(byte[][] bytes,
int nBytesToRead)
Read the required number of bytes.
|
void |
removeStreamListener(XStreamListener aListener) |
void |
write(byte[] aData)
Write bytes.
|
public static final boolean DEBUG
protected java.lang.String _description
protected java.net.Socket _socket
protected java.io.InputStream _inputStream
protected java.io.OutputStream _outputStream
protected java.util.Vector _listeners
protected boolean _firstRead
public SocketConnection(java.lang.String description,
java.net.Socket socket)
throws java.io.IOException
SocketConnection.
description - the description of the connectionsocket - the socket of the connectionjava.io.IOExceptionpublic void addStreamListener(XStreamListener aListener)
throws com.sun.star.uno.RuntimeException
com.sun.star.uno.RuntimeExceptionpublic void removeStreamListener(XStreamListener aListener)
throws com.sun.star.uno.RuntimeException
com.sun.star.uno.RuntimeExceptionpublic int read(byte[][] bytes,
int nBytesToRead)
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
aReadBytes - the outparameter, where the bytes have to be placednBytesToRead - the number of bytes to readcom.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptioncom.sun.star.connections.XConnection#readpublic void write(byte[] aData)
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
aData - the bytes to writecom.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptioncom.sun.star.connections.XConnection#writepublic void flush()
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
com.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptioncom.sun.star.connections.XConnection#flushpublic void close()
throws com.sun.star.io.IOException,
com.sun.star.uno.RuntimeException
com.sun.star.io.IOExceptioncom.sun.star.uno.RuntimeExceptioncom.sun.star.connections.XConnection#closepublic java.lang.String getDescription()
throws com.sun.star.uno.RuntimeException
com.sun.star.uno.RuntimeExceptioncom.sun.star.connections.XConnection#getDescription