javax.microedition.io (Java Card API, Connected Edition)
Date: 2009-12-11

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package javax.microedition.io

Provides the classes and interfaces for the Generic Connection Framework.

See:
Description

Interface Summary
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 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 the classes and interfaces for the Generic Connection Framework.

See Runtime Environment Specification for the Java Card Platform, Connected Edition, chapters 1 and 6 for details.

The Generic Connection Framework 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

The following connection protocols must be supported on the Java Card platform, Connected Edition:

- TCP/IP Client Socket.

- TCP/IP Server Socket.

- HTTP Client Connection.

- SSL/TLS Client Socket.

- SSL/TLS Server Socket.

- File Connection.

Support of the following connection protocol is optional on the Java Card platform, Connected Edition:

- Datagram Socket.

The Generic Connection Framework must behave as defined below for the following protocols:

- TCP/IP Client Socket. URIs of the form "`socket://{host}:{port}`" must return an object with behavior that follows the `javax.microedition.io.SocketConnection` interface specification.

- TCP/IP Server Socket. URIs of the form "`socket:// | socket://:{port}`" must return an object with behavior that follows the `javax.microedition.io.ServerSocketConnection` interface specification.

- HTTP Client Connection. URIs of the form "`http``://{host}:{port}{path}`" must return an object with behavior that follows the `javax.microedition.io.HttpConnection` interface specification.

- SSL/TLS Client Socket. URIs of the form "`ssl://{host}:{port}`" must return an object with behavior that follows the `javax.microedition.io.SecureConnection` interface specification.

- SSL/TLS Server Socket. URIs of the form "`ssl:// | ssl://:{port}`" must return an object with behavior that follows the `javacardx.io.ServerSecureConnection` interface specification.

- HTTPS Client Connection. URIs of the form "`https``://{host}:{port}{path}`" must return an object with behavior that follows the `javax.microedition.io.HttpsConnection` interface specification.

- File Connection. URIs of the form "`file`://`{path}`" (File URLs as defined by RFC 1738 - http://www.w3.org/Addressing/rfc1738.txt) must return an object which implements either `javax.microedition.io.InputConnection` (for "read" mode), `javax.microedition.io.OutputConnection` (for "write" mode) or `javax.microedition.io.StreamConnection` (for "read/write" mode).

- Datagram Socket. URIs of the form "`datagram://[{host}]:{port}`" must return an object with behavior that follows the `javax.microedition.io.UDPDatagramConnection` interface specification which extends the `javax.microedition.io.DatagramConnection` interface.

## Generic Connection Framework (GCF) Security Checks

Access to connections of the required protocol types via the methods of `javax.microedition.io.Connector` is governed by certain `javacardx.io.ConnectorPermission` checks, as described below:

Protocol | URI Form | Permission Check
TCP/IP Client Socket | `socket://{host}:{port}` | `ConnectorPermission("socket://{host}:{port}", "connect")`
TCP/IP Server Socket | `socket://:{port}` | `ConnectorPermission("socket://:{port}", "listen")`
HTTP 1.1 | `http://{host}[:{port}][{path}]` | `ConnectorPermission("http://{host}[:{port}][{path}]", "connect")`
HTTPS | `https://{host}[:{port}][{path}]` | `ConnectorPermission("https://{host}:{port}[{path}]", "connect")`
Secure Client Socket | `ssl://{host}:{port}` | `ConnectorPermission("ssl://{host}:{port}", "connect")`
Secure Server Socket | `ssl://:{port}` | `ConnectorPermission("ssl://:{port}", "listen")`
File I/O | `file://{path}` (reading) `file://{path}` (writing) | `ConnectorPermission("file://{path}", "read")` `ConnectorPermission("file://{path}", "write")`
Datagram Socket | `datagram://{host}:{port}` `datagram://:{port}` | `ConnectorPermission("datagram://{host}:{port}", "connect")` `ConnectorPermission("datagram://:{port}", "listen")`

For protocol implementations that delay the opening of the physical link to the targeted resources to the actual opening of the input and output streams, the methods `javax.microedition.io.InputConnection.openDataInputStream()`, `javax.microedition.io.InputConnection.openInputStream()`, `javax.microedition.io.OutputConnection.openDataOutputStream()` and `javax.microedition.io.OutputConnection.openOutputStream()` result in the same permission checks as the ones described above for the methods of `javax.microedition.io.Connector`.
In such a configuration, a security policy update between a call to `Connector.open()` and a call to `InputConnection.openInputStream()` (for example) on the returned `Connection` object may result in a `SecurityException` to be thrown if the permission is no longer granted.

The methods `javax.microedition.io.StreamConnectionNotifier.acceptAndOpen()` and `javax.microedition.io.DatagramConnection.receive()` result in permission checks, as described below:

Protocol | URI Form of the client connection being accepted | Permission Check
TCP/IP Server Socket (`StreamConnectionNotifier.acceptAndOpen()` method) | `socket://{host}:{port}` | `ConnectorPermission("socket://{host}:{port}", "accept")`
Secure Server Socket (`StreamConnectionNotifier.acceptAndOpen()` method) | `ssl://{host}:{port}` | `ConnectorPermission("ssl://{host}:{port}", "accept")`
Datagram Socket (`DatagramConnection.receive()` method) | `datagram://{host}:{port}` | `ConnectorPermission("datagram://{host}:{port}", "accept")`

Since:
  CLDC1.0, CDC 1.1, Foundation Profile 1.1, Java Card 3.0
See Also:
  `javacardx.io`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.