DCT Lightfoot v3 API specification

javax.microedition.io
Interface Datagram

All Superinterfaces:
java.io.DataInput, java.io.DataOutput

public interface Datagram
extends java.io.DataInput, java.io.DataOutput

This is the datagram interface, which represents an object used by Datagram connections to send / receive data


Method Summary
 java.lang.String getAddress()
          Get the address in the datagram.
 byte[] getData()
          Get the data buffer
 int getLength()
          Get the datagram length.
 int getOffset()
          Get the offset.
 void reset()
          Zero the read/write pointer as well as the offset and length parameters.
 void setAddress(Datagram reference)
          Set datagram address, copying the address from another datagram.
 void setAddress(java.lang.String addr)
          Set datagram address.
 void setData(byte[] buffer, int offset, int len)
          Set the buffer, offset and length.
 void setLength(int len)
          Set the length.
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
 
Methods inherited from interface java.io.DataOutput
write, write, write, writeBoolean, writeByte, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 

Method Detail

getAddress

public java.lang.String getAddress()
Get the address in the datagram.

Returns:
the address in string form, or null if no address was set

getData

public byte[] getData()
Get the data buffer

Returns:
the data buffer

getLength

public int getLength()
Get the datagram length.

Returns:
the length of the data

getOffset

public int getOffset()
Get the offset.

Returns:
the offset into the data buffer

setAddress

public void setAddress(java.lang.String addr)
                throws IOException
Set datagram address.
The default (if not set) is that of the connection.

Parameters:
addr - the new target address as a URL
Throws:
IllegalArgumentException - if the address is not valid
IOException - if a some kind of I/O error occurs

setAddress

public void setAddress(Datagram reference)
Set datagram address, copying the address from another datagram.

Parameters:
reference - the datagram who's address will be copied as the new target address for this datagram.
Throws:
IllegalArgumentException - if the address is not valid
See Also:
getAddress()

setLength

public void setLength(int len)
Set the length.

Parameters:
len - the new length of the data
Throws:
IllegalArgumentException - if the length is negative or larger than the buffer
See Also:
getLength()

setData

public void setData(byte[] buffer,
                    int offset,
                    int len)
Set the buffer, offset and length.

Parameters:
buffer - the data buffer
offset - the offset into the data buffer
len - the length of the data in the buffer
Throws:
IllegalArgumentException - if the length or offset fall outside the buffer
See Also:
getData()

reset

public void reset()
Zero the read/write pointer as well as the offset and length parameters.


DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification