Thursday 14 March 2013

javax.microedition.io Connector


javax.microedition.io
Connector

Declaration
public class Connector
java.lang.Object
|
+--javax.microedition.io.Connector
Description
This class is factory for creating new Connection objects.
The creation of Connections is performed dynamically by looking up a protocol implementation class whose
name is formed from the platform name (read from a system property) and the protocol name of the requested
connection (extracted from the parameter string supplied by the application programmer.) The parameter string
that describes the target should conform to the URL format as described in RFC 2396. This takes the general
form:
{scheme}:[{target}][{params}]
where {scheme} is the name of a protocol such as http}.
The {target} is normally some kind of network address.
Any {params} are formed as a series of equates of the form “;x=y”. Example: “;type=a”.
An optional second parameter may be specified to the open function. This is a mode flag that indicates to the
protocol handler the intentions of the calling code. The options here specify if the connection is going to be read
(READ), written (WRITE), or both (READ_WRITE). The validity of these flag settings is protocol dependent.
For instance, a connection for a printer would not allow read access, and would throw an
IllegalArgumentException. If the mode parameter is not specified, READ_WRITE is used by default.
An optional third parameter is a boolean flag that indicates if the calling code can handle timeout exceptions. If
this flag is set, the protocol implementation may throw an InterruptedIOException when it detects a timeout
condition. This flag is only a hint to the protocol handler, and it does not guarantee that such exceptions will
actually be thrown. If this parameter is not set, no timeout exceptions will be thrown.
Because connections are frequently opened just to gain access to a specific input or output stream, four
convenience functions are provided for this purpose. See also: DatagramConnection for information
relating to datagram addressing

Fields
static int READ
static int READ_WRITE
static int WRITE
Methods
static Connection open(java.lang.String name)

static Connection open(java.lang.String name, int mode)
static Connection open(java.lang.String name, int mode, boolean timeouts)
static
java.io.DataInputStrea
m
openDataInputStream(java.lang.String name)
static
java.io.DataOutputStre
am
openDataOutputStream(java.lang.String name)
static
java.io.InputStream
openInputStream(java.lang.String name)
static
java.io.OutputStream
openOutputStream(java.lang.String name)

Methods inherited from class Object
equals(Object), getClass(), hashCode(), notify(), notifyAll(), toString(), wait(),
wait(), wait()

Fields
READ
Declaration:
public static final int READ
Description:
Access mode READ.
WRITE
Declaration:
public static final int WRITE
Description:
Access mode WRITE.
READ_WRITE
Declaration:
public static final int READ_WRITE
Description:
Access mode READ_WRITE.

Methods
open(String)
Declaration:
public static javax.microedition.io.Connection open(java.lang.String name)
throws IOException
Description:
Create and open a Connection.
Parameters:
name - The URL for the connection.
Returns: A new Connection object.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
open(String, int)
Declaration:
public static javax.microedition.io.Connection open(java.lang.String name, int mode)
throws IOException
Description:
Create and open a Connection.
Parameters:
name - The URL for the connection.
mode - The access mode.
Returns: A new Connection object.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
open(String, int, boolean)
Declaration:
public static javax.microedition.io.Connection open(java.lang.String name, int mode,
boolean timeouts)
throws IOException

openDataInputStream(String)
310
Description:
Create and open a Connection.
Parameters:
name - The URL for the connection
mode - The access mode
timeouts - A flag to indicate that the caller wants timeout exceptions
Returns: A new Connection object
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
openDataInputStream(String)
Declaration:
public static java.io.DataInputStream openDataInputStream(java.lang.String name)
throws IOException
Description:
Create and open a connection input stream.
Parameters:
name - The URL for the connection.
Returns: A DataInputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
openDataOutputStream(String)
Declaration:
public static java.io.DataOutputStream openDataOutputStream(java.lang.String name)
throws IOException
Description:
Create and open a connection output stream.
Parameters:
name - The URL for the connection.
Returns: A DataOutputStream.

Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
openInputStream(String)
Declaration:
public static java.io.InputStream openInputStream(java.lang.String name)
throws IOException
Description:
Create and open a connection input stream.
Parameters:
name - The URL for the connection.
Returns: An InputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.
openOutputStream(String)
Declaration:
public static java.io.OutputStream openOutputStream(java.lang.String name)
throws IOException
Description:
Create and open a connection output stream.
Parameters:
name - The URL for the connection.
Returns: An OutputStream.
Throws:
java.lang.IllegalArgumentException - If a parameter is invalid.
ConnectionNotFoundException - If the target of the name cannot be found, or if the requested
protocol type is not supported.
java.io.IOException - If some other kind of I/O error occurs.
java.lang.SecurityException - May be thrown if access to the protocol handler is
prohibited.








No comments:

Post a Comment