javax.microedition.io
Class Connector

java.lang.Object
  |
  +--javax.microedition.io.Connector

public class Connector
extends Object

This class is a place holder for the static methods used to create all the connection objects.

This is done by dynamically looking up a class the name of which is formed from the platform name and the protocol of the requested connection. The class name will take the form:

com.sun.cldc.io.{platform}.{protocol}.Protocol

The platform name is derived from the system by looking for the system property "j2me.platform". If this property key is not found or the associated class is not present then one of two default directories are used. These are called "j2me" and "j2se". If the property "j2me.configuration" is non-null then "j2me" is used, otherwise "j2se" is assumed.

The protocol name is derived from the parameter string describing the target of the connection. This takes the from:

{protocol}:[{target}][ {parms}]

The protocol name is used to find the appropriate class and stripped from the target name before being passed to open() method of a new instanceation of the class. See also: DatagramConnection for information relating to datagram addressing


Field Summary
static int READ
          Access mode
static int READ_WRITE
          Access mode
static int WRITE
          Access mode
 
Method Summary
static Connection open(String name)
          Create and open a Connection
static Connection open(String name, int mode)
          Create and open a Connection
static Connection open(String name, int mode, boolean timeouts)
          Create and open a Connection
static DataInputStream openDataInputStream(String name)
          Create and open a connection input stream
static DataOutputStream openDataOutputStream(String name)
          Create and open a connection output stream
static InputStream openInputStream(String name)
          Create and open a connection input stream
static OutputStream openOutputStream(String name)
          Create and open a connection output stream
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ

public static final int READ
Access mode

WRITE

public static final int WRITE
Access mode

READ_WRITE

public static final int READ_WRITE
Access mode
Method Detail

open

public static Connection open(String name)
                       throws IOException
Create and open a Connection
Parameters:
string - The URL for the connection
Returns:
A new Connection object
Throws:
IOException - If an I/O error occurs

open

public static Connection open(String name,
                              int mode)
                       throws IOException
Create and open a Connection
Parameters:
string - The URL for the connection
mode - The access mode
Returns:
A new Connection object
Throws:
IOException - If an I/O error occurs

open

public static Connection open(String name,
                              int mode,
                              boolean timeouts)
                       throws IOException
Create and open a Connection
Parameters:
string - The URL for the connection
mode - The access mode
timeouts - A flag to indicate that the called wants timeout exceptions
Returns:
A new Connection object
Throws:
IOException - If an I/O error occurs

openDataInputStream

public static DataInputStream openDataInputStream(String name)
                                           throws IOException
Create and open a connection input stream
Parameters:
string - The URL for the connection
Returns:
An InputStream
Throws:
IOException - If an I/O error occurs

openDataOutputStream

public static DataOutputStream openDataOutputStream(String name)
                                             throws IOException
Create and open a connection output stream
Parameters:
string - The URL for the connection
Returns:
An OutputStream
Throws:
IOException - If an I/O error occurs

openInputStream

public static InputStream openInputStream(String name)
                                   throws IOException
Create and open a connection input stream
Parameters:
string - The URL for the connection
Returns:
An InputStream
Throws:
IOException - If an I/O error occurs

openOutputStream

public static OutputStream openOutputStream(String name)
                                     throws IOException
Create and open a connection output stream
Parameters:
string - The URL for the connection
Returns:
An OutputStream
Throws:
IOException - If an I/O error occurs