javax.microedition.io
Class Connector

java.lang.Object
  extended by javax.microedition.io.Connector

public class Connector
extends Object

This is a factory class to create different data connections, such as Bluetooth or USB. Currently it only supports Bluetooth SPP (btspp://).

Author:
BB

Field Summary
static int READ
          Access mode READ.
static int READ_WRITE
          Access mode READ_WRITE.
static int WRITE
          Access mode WRITE.
 
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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READ

public static final int READ
Access mode READ. The value 1 is assigned to READ.

See Also:
Constant Field Values

WRITE

public static final int WRITE
Access mode WRITE. The value 2 is assigned to WRITE.

See Also:
Constant Field Values

READ_WRITE

public static final int READ_WRITE
Access mode READ_WRITE. The value 3 is assigned to READ_WRITE.

See Also:
Constant Field Values
Method Detail

open

public static Connection open(String name)
                       throws IOException
Create and open a Connection.

Parameters:
name - The URL for the connection.
Returns:
A new Connection object.
Throws:
IllegalArgumentException - - If a parameter is invalid.
ConnectionNotFoundException - - If the requested connection cannot be made, or the protocol type does not exist.
IOException - - If some other kind of I/O error occurs.

open

public static Connection open(String name,
                              int mode)
                       throws IOException
Create and open a Connection.

Parameters:
name - The URL for the connection.
mode - The mode for connection (READ, WRITE, READ_WRITE)
Returns:
A new Connection object.
Throws:
IllegalArgumentException - - If a parameter is invalid.
ConnectionNotFoundException - - If the requested connection cannot be made, or the protocol type does not exist.
IOException - - If some other kind of I/O error occurs.

open

public static Connection open(String name,
                              int mode,
                              boolean timeouts)
                       throws IOException
Create and open a Connection.

Parameters:
name - The URL for the connection.
mode - The mode for connection (READ, WRITE, READ_WRITE)
timeouts -
Returns:
A new Connection object.
Throws:
IllegalArgumentException - - If a parameter is invalid.
ConnectionNotFoundException - - If the requested connection cannot be made, or the protocol type does not exist.
IOException - - If some other kind of I/O error occurs.

openDataInputStream

public static DataInputStream openDataInputStream(String name)
                                           throws IOException
Create and open a connection input stream.

Parameters:
name - The URL for the connection stream.
Returns:
the data input stream
Throws:
IOException

openDataOutputStream

public static DataOutputStream openDataOutputStream(String name)
                                             throws IOException
Create and open a connection output stream.

Parameters:
name - The URL for the connection.
Returns:
the data output stream
Throws:
IOException

openInputStream

public static InputStream openInputStream(String name)
                                   throws IOException
Create and open a connection input stream.

Parameters:
name - The URL for the connection.
Returns:
the input stream
Throws:
IOException

openOutputStream

public static OutputStream openOutputStream(String name)
                                     throws IOException
Create and open a connection output stream.

Parameters:
name - The URL for the connection.
Returns:
the output stream
Throws:
IOException