DCT Lightfoot v3 API specification

com.dctl.j2me.io.socket
Class Connection

java.lang.Object
  |
  +--com.dctl.j2me.io.BaseConnection
        |
        +--com.dctl.j2me.io.socket.Connection
All Implemented Interfaces:
Connection, InputConnection, OutputConnection, StreamConnection

public class Connection
extends BaseConnection
implements StreamConnection

Sockets are TCP connections between one system and the other. They are basically stream connections over the network
Sockets are opened using the URL "socket://:"


Field Summary
protected  int handle
          This is the handle we use - it can be accessed by the stream classes
 
Fields inherited from class com.dctl.j2me.io.BaseConnection
protocol
 
Constructor Summary
Connection()
          The default constructor - this is required to set the handle
Connection(int handle)
          Create a new connection with the handle already there - used by the server socket accept and open method
 
Method Summary
 void close()
          Close the underlying socket.
 void closeInputStream()
          Close method called by an input stream
 void closeOutputStream()
          Close method called by an output stream
protected  void openConnection()
          Open the connection using the values in address, port and parameters
 java.io.DataInputStream openDataInputStream()
          Open a data input stream
 java.io.DataOutputStream openDataOutputStream()
          Open a data output stream
 InputStream openInputStream()
          Open an input stream
 OutputStream openOutputStream()
          Open an output stream
 void setParameters(java.lang.String url, int mode, boolean timeouts)
          Set the URL, mode and timeouts
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handle

protected int handle
This is the handle we use - it can be accessed by the stream classes

Constructor Detail

Connection

public Connection()
The default constructor - this is required to set the handle


Connection

public Connection(int handle)
Create a new connection with the handle already there - used by the server socket accept and open method

Parameters:
handle - The handle to use
Method Detail

setParameters

public void setParameters(java.lang.String url,
                          int mode,
                          boolean timeouts)
                   throws IOException
Set the URL, mode and timeouts

Specified by:
setParameters in class BaseConnection
Parameters:
url - The URL passed to connector.open
mode - The mode passed to connector.open or DEFAULT
timeouts - true if timeout exceptions should occur
Throws:
IOException - if there is a problem

openConnection

protected void openConnection()
                       throws IOException
Open the connection using the values in address, port and parameters

Throws:
IOException - if there is an error

close

public void close()
           throws IOException
Close the underlying socket. This should only be closed when the open count goes down to zero.

Specified by:
close in interface Connection
Throws:
IOException - if there is an error

closeInputStream

public void closeInputStream()
                      throws IOException
Close method called by an input stream

Throws:
IOException - if the socket is not alive

closeOutputStream

public void closeOutputStream()
                       throws IOException
Close method called by an output stream

Throws:
IOException - if the socket is not alive

openInputStream

public InputStream openInputStream()
                            throws IOException
Open an input stream

Specified by:
openInputStream in interface InputConnection
Returns:
the input stream
Throws:
IOException - if there is an error

openDataInputStream

public java.io.DataInputStream openDataInputStream()
                                            throws IOException
Open a data input stream

Specified by:
openDataInputStream in interface InputConnection
Returns:
the data input stream
Throws:
IOException - if there is an error

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Open an output stream

Specified by:
openOutputStream in interface OutputConnection
Returns:
the output stream
Throws:
IOException - if there is an error

openDataOutputStream

public java.io.DataOutputStream openDataOutputStream()
                                              throws IOException
Open a data output stream

Specified by:
openDataOutputStream in interface OutputConnection
Returns:
the data output stream
Throws:
IOException - if there is an error

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification