Top Description Fields Constructors Methods
com.sun.star.lib.connections.socket

public Class SocketConnection

extends Object
implements com.sun.star.connection.XConnection, com.sun.star.connection.XConnectionBroadcaster
Class Inheritance
Imports
java.io.BufferedInputStream, .BufferedOutputStream, .IOException, .InputStream, .OutputStream, java.net.Socket, java.util.ArrayList, .Arrays, com.sun.star.connection.XConnection, com.sun.star.connection.XConnectionBroadcaster, com.sun.star.io.XStreamListener

The SocketConnection implements the XConnection interface and is uses by the SocketConnector and the SocketAcceptor.

This class is not part of the provided api.

Since
UDK1.0
See Also
com.sun.star.lib.connections.socket.socketAcceptor, com.sun.star.lib.connections.socket.socketConnector, com.sun.star.connection.XConnection

Field Summary

Modifier and TypeField and Description
protected String
protected boolean
protected InputStream
protected ArrayList<com.sun.star.io.XStreamListener>
protected OutputStream
protected Socket
public static final boolean
DEBUG

When set to true, enables various debugging output.

Constructor Summary

AccessConstructor and Description
public
SocketConnection(String
the description of the connection.
description
,
Socket
the socket of the connection.
socket
)

Constructs a new SocketConnection.

Method Summary

Modifier and TypeMethod and Description
public void
addStreamListener(com.sun.star.io.XStreamListener aListener)

public void
close()

Closes the connection.

public void
flush()

Flushes the buffer.

public String

Returns:

the description.
getDescription
()

Gives a description of the connection.

private void
private void
notifyListeners_error(com.sun.star.uno.Exception exception)

private void
public int

Returns:

the number of bytes read.
read
(byte[][]
the outparameter, where the bytes have to be placed.
bytes
,
int
the number of bytes to read.
nBytesToRead
)

Read the required number of bytes.

public void
removeStreamListener(com.sun.star.io.XStreamListener aListener)

public void
write(byte[]
the bytes to write.
aData
)

Write bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_descriptionback to summary
protected String _description
_firstReadback to summary
protected boolean _firstRead
_inputStreamback to summary
protected InputStream _inputStream
_listenersback to summary
protected ArrayList<com.sun.star.io.XStreamListener> _listeners
_outputStreamback to summary
protected OutputStream _outputStream
_socketback to summary
protected Socket _socket
DEBUGback to summary
public static final boolean DEBUG

When set to true, enables various debugging output.

Constructor Detail

SocketConnectionback to summary
public SocketConnection(String description, Socket socket) throws IOException

Constructs a new SocketConnection.

Parameters
description:String

the description of the connection.

socket:Socket

the socket of the connection.

Method Detail

addStreamListenerback to summary
public void addStreamListener(com.sun.star.io.XStreamListener aListener) throws com.sun.star.uno.RuntimeException
closeback to summary
public void close() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException

Closes the connection.

See Also
com.sun.star.connection.XConnection#close
flushback to summary
public void flush() throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException

Flushes the buffer.

See Also
com.sun.star.connection.XConnection#flush
getDescriptionback to summary
public String getDescription() throws com.sun.star.uno.RuntimeException

Gives a description of the connection.

Returns:String

the description.

See Also
com.sun.star.connection.XConnection#getDescription
notifyListeners_closeback to summary
private void notifyListeners_close()
notifyListeners_errorback to summary
private void notifyListeners_error(com.sun.star.uno.Exception exception)
notifyListeners_openback to summary
private void notifyListeners_open()
readback to summary
public int read(byte[][] bytes, int nBytesToRead) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException

Read the required number of bytes.

Parameters
bytes:byte[][]

the outparameter, where the bytes have to be placed.

nBytesToRead:int

the number of bytes to read.

Returns:int

the number of bytes read.

See Also
com.sun.star.connection.XConnection#read
removeStreamListenerback to summary
public void removeStreamListener(com.sun.star.io.XStreamListener aListener) throws com.sun.star.uno.RuntimeException
writeback to summary
public void write(byte[] aData) throws com.sun.star.io.IOException, com.sun.star.uno.RuntimeException

Write bytes.

Parameters
aData:byte[]

the bytes to write.

See Also
com.sun.star.connection.XConnection#write