DCT Lightfoot v3 API specification

javax.microedition.io
Interface DatagramConnection

All Superinterfaces:
Connection
All Known Implementing Classes:
Connection

public interface DatagramConnection
extends Connection

Interface for a connection which uses Datagrams to send and receive data


Method Summary
 int getMaximumLength()
          Get the maximum length a datagram can be.
 int getNominalLength()
          Get the nominal length of a datagram.
 Datagram newDatagram(byte[] buf, int size)
          Make a new datagram object.
 Datagram newDatagram(byte[] buf, int size, java.lang.String addr)
          Make a new datagram object.
 Datagram newDatagram(int size)
          Make a new datagram object automatically allocating a buffer.
 Datagram newDatagram(int size, java.lang.String addr)
          Make a new datagram object.
 void receive(Datagram dgram)
          Receive a datagram.
 void send(Datagram dgram)
          Send a datagram.
 
Methods inherited from interface javax.microedition.io.Connection
close
 

Method Detail

getMaximumLength

public int getMaximumLength()
                     throws IOException
Get the maximum length a datagram can be.

Returns:
The maximum length a datagram can be.
Throws:
IOException - If an I/O error occurs.

getNominalLength

public int getNominalLength()
                     throws IOException
Get the nominal length of a datagram.

Returns:
The nominal length a datagram can be.
Throws:
IOException - If an I/O error occurs.

send

public void send(Datagram dgram)
          throws IOException
Send a datagram.

Parameters:
dgram - A datagram.
Throws:
IOException - If an I/O error occurs.
InterruptedIOException - Timeout or upon closing the connection with outstanding I/O.

receive

public void receive(Datagram dgram)
             throws IOException
Receive a datagram.

Parameters:
dgram - A datagram.
Throws:
IOException - If an I/O error occurs.
InterruptedIOException - Timeout or upon closing the connection with outstanding I/O.

newDatagram

public Datagram newDatagram(int size)
                     throws IOException
Make a new datagram object automatically allocating a buffer.

Parameters:
size - The length of the buffer to be allocated for the datagram
Returns:
A new datagram
Throws:
IOException - If an I/O error occurs.
IllegalArgumentException - if the length is negative or larger than the buffer

newDatagram

public Datagram newDatagram(int size,
                            java.lang.String addr)
                     throws IOException
Make a new datagram object.

Parameters:
size - The length of the buffer to be used
addr - The I/O address to which the datagram will be sent
Returns:
A new datagram
Throws:
IOException - If an I/O error occurs.
IllegalArgumentException - if the length is negative or larger than the buffer, or if the address parameter is invalid

newDatagram

public Datagram newDatagram(byte[] buf,
                            int size)
                     throws IOException
Make a new datagram object.

Parameters:
buf - The buffer to be used in the datagram
size - The length of the buffer to be allocated for the datagram
Returns:
A new datagram
Throws:
IOException - If an I/O error occurs.
IllegalArgumentException - if the length is negative or larger than the buffer, or if the buffer parameter is invalid

newDatagram

public Datagram newDatagram(byte[] buf,
                            int size,
                            java.lang.String addr)
                     throws IOException
Make a new datagram object.

Parameters:
buf - The buffer to be used in the datagram
size - The length of the buffer to be used
addr - The I/O address to which the datagram will be sent
Returns:
A new datagram
Throws:
IOException - If an I/O error occurs.
IllegalArgumentException - if the length is negative or larger than the buffer, or if the address or buffer parameters is invalid

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification