DCT Lightfoot v3 API specification

com.dctl.j2me.io.datagram
Class Connection

java.lang.Object
  |
  +--com.dctl.j2me.io.BaseConnection
        |
        +--com.dctl.j2me.io.datagram.Connection
All Implemented Interfaces:
Connection, DatagramConnection

public class Connection
extends BaseConnection
implements DatagramConnection

The datagram connection class that supports IP datagrams


Field Summary
 
Fields inherited from class com.dctl.j2me.io.BaseConnection
protocol
 
Constructor Summary
Connection()
           
 
Method Summary
 void close()
          Close the socket
 int getMaximumLength()
          Cet the maximum length datagram we can send
 int getNominalLength()
          Get the nominal length datagram to send
 Datagram newDatagram(byte[] buf, int len)
          Create a new datagram to be used on this connection
 Datagram newDatagram(byte[] buf, int len, java.lang.String addr)
          Create a new datagram to be used on this connection
 Datagram newDatagram(int len)
          Create a new datagram to be used on this connection
 Datagram newDatagram(int len, java.lang.String addr)
          Create a new datagram to be used on this connection
 void receive(Datagram dgram)
          Receive a datagram on the connection
 void send(Datagram dgram)
          Send a datagram on the connection to the requested address/port
 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
 

Constructor Detail

Connection

public Connection()
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

getMaximumLength

public int getMaximumLength()
Cet the maximum length datagram we can send

Specified by:
getMaximumLength in interface DatagramConnection
Returns:
the maximum length

getNominalLength

public int getNominalLength()
Get the nominal length datagram to send

Specified by:
getNominalLength in interface DatagramConnection
Returns:
the nominal length

newDatagram

public Datagram newDatagram(byte[] buf,
                            int len)
                     throws IOException
Create a new datagram to be used on this connection

Specified by:
newDatagram in interface DatagramConnection
Parameters:
buf - The buffer to use
len - the length of buffer to use for the datagram
Returns:
the datagram
Throws:
IOException - if there is an error
IllegalArgumentException - if the buffer/length is invalid

newDatagram

public Datagram newDatagram(byte[] buf,
                            int len,
                            java.lang.String addr)
                     throws IOException
Create a new datagram to be used on this connection

Specified by:
newDatagram in interface DatagramConnection
Parameters:
buf - The buffer to use
len - The length of the buffer to use for the datagram
addr - The address of the other side
Returns:
the datagram
Throws:
IOException - if there is an error
IllegalArgumentException - if the buffer/length is invalid

newDatagram

public Datagram newDatagram(int len)
                     throws IOException
Create a new datagram to be used on this connection

Specified by:
newDatagram in interface DatagramConnection
Parameters:
len - the length of buffer to use for the datagram
Returns:
the datagram
Throws:
IOException - if there is an error
IllegalArgumentException - if the length is invalid

newDatagram

public Datagram newDatagram(int len,
                            java.lang.String addr)
                     throws IOException
Create a new datagram to be used on this connection

Specified by:
newDatagram in interface DatagramConnection
Parameters:
len - The length of the buffer to use for the datagram
addr - The address of the other side
Returns:
the datagram
Throws:
IOException - if there is an error
IllegalArgumentException - if the length is invalid

receive

public void receive(Datagram dgram)
             throws IOException
Receive a datagram on the connection

Specified by:
receive in interface DatagramConnection
Parameters:
dgram - The datagram to use to receive data
Throws:
IOException - if there is an error

send

public void send(Datagram dgram)
          throws IOException
Send a datagram on the connection to the requested address/port

Specified by:
send in interface DatagramConnection
Parameters:
dgram - The datagram to send
Throws:
IOException - if there is an error

close

public void close()
           throws IOException
Close the socket

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

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification