j2me 联网技术分析总结
基本点:Generic Connections
In the CLDC Generic Connection framework, all connections are created usingthe open static method from the Connector class. Ifsuccessful, this method returns an object that implements one of the genericconnection interfaces. Figure 1 shows how these interfaces form an is-ahierarchy. The Connection interface is the base interface suchthat StreamConnectionNotifier is a Connection andInputConnection is a Connection too.
http://developers.sun.com/mobility/images/network_fig1.gif
Figure 1: Connection interface hierarchy
[*]The Connection interface is the most basic connection type. It can only be opened and closed.
[*]The InputConnection interface represents a device from which data can be read. Its openInputStream method returns an input stream for the connection.
[*]The OuputConnection interface represents a device to which data can be written. Its openOutputStream method returns an output stream for the connection.
[*]The StreamConnection interface combines the input and output connections.
[*]The ContentConnection is a subinterface of StreamConnection. It provides access to some of the basic meta data information provided by HTTP connections.
[*]The StreamConnectionNotified waits for a connection to be established. It returns a StreamConnection on which a communication link has ben established.
[*]The DatagramConnection represents a datagram endpoint.
The open method of the Connector class has thefollowing syntax, where the String parameter has the format"protocol:address;parameters".
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!---->Connector.open(String);
页:
[1]