Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

Foundation 1.1.2

Package javax.microedition.io

Provides a simplified mechanism for applications to use various types of I/O protocols in resource-constrained environments.

See:
          Description

Interface Summary
CommConnection This interface defines a logical serial port connection.
Connection This is the most basic type of generic connection.
ContentConnection This interface defines the stream connection over which content is passed.
Datagram This class defines an abstract interface for datagram packets.
DatagramConnection This interface defines the capabilities that a datagram connection must have.
HttpConnection This interface defines the necessary methods and constants for an HTTP connection.
HttpsConnection This interface defines the necessary methods and constants to establish a secure network connection.
InputConnection This interface defines the capabilities that an input stream connection must have.
OutputConnection This interface defines the capabilities that an output stream connection must have.
SecureConnection This interface defines the secure socket stream connection.
SecurityInfo This interface defines methods to access information about a secure network connection.
ServerSocketConnection This interface defines the server socket stream connection.
SocketConnection This interface defines the socket stream connection.
StreamConnection This interface defines the capabilities that a stream connection must have.
StreamConnectionNotifier This interface defines the capabilities that a connection notifier must have.
UDPDatagramConnection This interface defines a datagram connection which knows it's local end point address.
 

Class Summary
Connector This class is a factory for creating new Connection objects.
 

Exception Summary
ConnectionNotFoundException This class is used to signal that a connection target cannot be found, or the protocol type is not supported.
 

Package javax.microedition.io Description

Provides a simplified mechanism for applications to use various types of I/O protocols in resource-constrained environments. I/O is performed by means of Connections obtained through the Connector factory class. Connections are dynamically created based on URIs of the form: {scheme}:[{target}][{params}] Please see the Connector class for more information.

Protocol Support (CDC)

The following connection protocols must be supported for CDC:


For the protocols above, the {host} parameter can either be a machine name, such as "www.jcp.org", or a string representing its IP address, such as "206.26.48.100".

Protocol Support (CDC/Foundation Profile)

The following connection protocols must be supported for CDC/Foundation Profile (only when Foundation Profile is present):

The implementation of the following MIDP interfaces are optional, as they have a dependency on SSL protocol.

If either one or the other of SecureConnection or HttpsConnection is implemented, or if the Java Secure Socket Extension (JSSE) part of the Java ME Security Optional Package is present, both of these two specific interfaces (SecureConnection and HttpsConnection) must be implemented as well.


For the protocols above, the {host} parameter can either be a machine name, such as "www.jcp.org", or a string representing its IP address, such as "206.26.48.100".

Generic Connection Framework (GCF) Security Checks (for CDC)

Access to connections of the required protocol types via the methods of javax.microedition.io.Connector is governed by certain java.lang.SecurityManager checks, as described below for CDC:

Protocol URI Form Security Check
File I/O file://{path} (reading)

file://{path} (writing)
checkRead({path})

checkWrite({path})
Datagram Socket datagram://{host}:{port}

datagram://:{port}
checkListen(0)

checkListen({port})

The methods javax.microedition.io.InputConnection.openDataInputStream() and javax.microedition.io.InputConnection.openInputStream() result in security checks, as described below:

Protocol URI Form Security Check
File Input file://{path} checkRead({path})

The methods javax.microedition.io.OutputConnection.openDataOutputStream() and javax.microedition.io.OutputConnection.openOutputStream() result in security checks, as described below:

Protocol URI Form Security Check
File Output file://{path} checkWrite({path})


Generic Connection Framework (GCF) Security Checks (for CDC/Foundation Profile)

Access to connections of the required protocol types via the methods of javax.microedition.io.Connector is governed by certain java.lang.SecurityManager checks, as described below for CDC/Foundation Profile (only when Foundation Profile is present):

Protocol URI Form Security Check
TCP/IP Client Socket socket://{host}:{port} checkConnect({host}, {port})
TCP/IP Server Socket socket://:{port} checkListen({port})
HTTP 1.1 http://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 80)

checkConnect({host}, {port})
HTTPS https://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 443)

checkConnect({host}, {port})
Secure Socket ssl://{host}:{port} checkConnect({host}, {port})
File I/O file://{path} (reading)

file://{path} (writing)
checkRead({path})

checkWrite({path})
Datagram Socket datagram://{host}:{port}

datagram://:{port}
checkListen(0)

checkListen({port})

The methods javax.microedition.io.InputConnection.openDataInputStream() and javax.microedition.io.InputConnection.openInputStream() result in security checks, as described below:

Protocol URI Form Security Check
HTTP 1.1 http://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 80)

checkConnect({host}, {port})
HTTPS https://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 443)

checkConnect({host}, {port})
Secure Socket ssl://{host}:{port} checkConnect({host}, {port})
File Input file://{path} checkRead({path})

The methods javax.microedition.io.OutputConnection.openDataOutputStream() and javax.microedition.io.OutputConnection.openOutputStream() result in security checks, as described below:

Protocol URI Form Security Check
HTTP 1.1 http://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 80)

checkConnect({host}, {port})
HTTPS https://{host}[{path}]

http://{host}:{port}[{path}]
checkConnect({host}, 443)

checkConnect({host}, {port})
Secure Socket ssl://{host}:{port} checkConnect({host}, {port})
File Output file://{path} checkWrite({path})




StreamConnection Behavior

Opening a DataInputStream counts as opening an InputStream and opening a DataOutputStream counts as opening an OutputStream. In Foundation Profile, multiple streams may be opened by one StreamConnection. Trying to open another InputStream or another OutputStream from a StreamConnection must not cause any exception. Trying to open InputStream or OutputStream after they have been closed causes an IOException.

After calling the close method, regardless of open streams, further method calls to connection will result in IOExceptions for those methods that are declared to throw IOExceptions. For the methods that do not throw exceptions, unknown results may be returned.


Foundation 1.1.2

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 219 specification.