2009-01-09 1.2.0

org.eclipse.soda.dk.connection.service
Interface ConnectionService

All Known Subinterfaces:
MultiplexConnectionService
All Known Implementing Classes:
Connection, StreamConnection, TraceConnection

public interface ConnectionService

The ConnectionService interface defines the ConnectionService concept. A ConnectionService is an encapsulation of a pair of streams, one input and one output. A user of a connection can open and close a connection, get each stream, and test if a stream is open. Generally, after opening a ConnectionService, and getting the streams, a ConnectionService user will read and write to the streams, closing the ConnectionService when finished.

Since:
1.0
Version:
1.2.0

Field Summary
static java.lang.String CONNECTION_DEFAULT
          Define the connection default (String) constant.
static java.lang.String CONNECTION_KEY
          Define the connection key (String) constant.
static java.lang.String CONNECTION_TYPE
          Define the connection type (String) constant.
static java.lang.String DEFAULT_CONNECTION
          Deprecated. #CONNECTION_DEFAULT
static java.lang.String SERVICE_NAME
          Define the OSGi service name.
 
Method Summary
 void close()
          Perform the close action method.
 void exit()
          Request the connection to exit.
 void flush()
          Flush any data to be written.
 boolean isOpen()
          Gets the boolean open property value.
 void open()
          Perform the open action method.
 int read(byte[] bytes)
          Read data into the bytes specified.
 int read(byte[] bytes, int offset, int length)
          Read data into the bytes specified.
 void setConfigurationInformation(java.util.Dictionary configurationInformation)
          Sets the configuration information value.
 void write(byte[] bytes)
          Writes the bytes from the byte array.
 void write(byte[] bytes, int offset, int count)
          Writes count bytes from the byte array buffer starting at offset.
 

Field Detail

SERVICE_NAME

static final java.lang.String SERVICE_NAME
Define the OSGi service name.

See Also:
Constant Field Values

CONNECTION_KEY

static final java.lang.String CONNECTION_KEY
Define the connection key (String) constant.

See Also:
Constant Field Values

CONNECTION_TYPE

static final java.lang.String CONNECTION_TYPE
Define the connection type (String) constant.

See Also:
Constant Field Values

CONNECTION_DEFAULT

static final java.lang.String CONNECTION_DEFAULT
Define the connection default (String) constant.

Since:
1.2
See Also:
Constant Field Values

DEFAULT_CONNECTION

static final java.lang.String DEFAULT_CONNECTION
Deprecated. #CONNECTION_DEFAULT
Define the default connection (String) constant.

See Also:
Constant Field Values
Method Detail

close

void close()
           throws java.io.IOException
Perform the close action method. This API closes the ConnectionService, including the contained Streams. It may throw an IOException if it fails while closing either stream.> exception condition occurs.

Throws:
java.io.IOException - IOException.

exit

void exit()
          throws java.io.IOException
Request the connection to exit. The connection will be closed. It will no longer read or write. All resources will be released. After an exit, the connection service can not be restarted.

Throws:
java.io.IOException - IOException.

flush

void flush()
           throws java.io.IOException
Flush any data to be written. an error occurs attempting to flush this Writer.

Throws:
java.io.IOException - IOException.

isOpen

boolean isOpen()
Gets the boolean open property value. This API returns a boolean which tells whether or not the ConnectionService contains valid, open streams.

Returns:
Results of the is open (boolean) value.

open

void open()
          throws java.io.IOException
Perform the open action method. This API opens the ConnectionService, including the contained Streams. It may throw an IOException if it fails while opening either stream.

Throws:
java.io.IOException - IOException.

read

int read(byte[] bytes)
         throws java.io.IOException
Read data into the bytes specified.

Parameters:
bytes - The bytes (byte[]) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException - IOException.
See Also:
read(byte[],int,int)

read

int read(byte[] bytes,
         int offset,
         int length)
         throws java.io.IOException
Read data into the bytes specified. the byte array in which to store the read bytes.

Parameters:
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
length - The length (int) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException - IOException.
See Also:
read(byte[])

setConfigurationInformation

void setConfigurationInformation(java.util.Dictionary configurationInformation)
Sets the configuration information value.

Parameters:
configurationInformation - The configuration information (Dictionary) parameter.

write

void write(byte[] bytes)
           throws java.io.IOException
Writes the bytes from the byte array.

Parameters:
bytes - The bytes (byte[]) parameter.
Throws:
java.io.IOException - IOException.
See Also:
write(byte[],int,int)

write

void write(byte[] bytes,
           int offset,
           int count)
           throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset.

Parameters:
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
count - The count (int) parameter.
Throws:
java.io.IOException - IOException.
See Also:
write(byte[])

2009-01-09 1.2.0

Copyright (c) 2009 IBM. See license in Legal section.