Tuesday, November 10, 2009

J2ME - Generic Connection Framework (GCF)

GCF was originally defined to rely on the J2ME platform's Connected Limited Device Configuration (CLDC), version 1.0, because the familiar J2SE java.net and java.io APIs were considered too large to fit into the constrained memory available in mobile devices.

Today you can find the GCF not only in CLDC-based profiles, such as the Mobile Information Device Profile (MIDP) and the Information Module Profile (IMP), but also in Connected Device Configuration (CDC)-based profiles. You can also find the GCF in an increasing number of optional packages, including those that provide Bluetooth support and access to files and smart cards.

A Generic Approach to Connectivity

As the name suggests, the GCF provides a generic approach to connectivity. It is generic because it provides a common foundation API for all the basic onnection types - for packet-based (data blocks) and stream-based (contiguous or sequence of data) input and output.

This generalization is possible through the use of:

  • An interface hierarchy that is extensible
  • A connection factory
  • Standard Uniform Resource Locators (URLs) to indicate the connection types to create


A total of seven interfaces are defined in GCF, with Connection at the top. Importantly we have to look that both datagram (packet) and stream connections are supported. As we will move down in the hierarchy, connections become more complex and functional.

For packet-based I/O the GCF defines DatagramConnection, and for stream-based I/O InputConnection, OutputConnection, StreamConnection, and ContentConnection.

The GCF is so practical and flexible that it is used across J2ME profiles and optional packages, and now on the J2SE platform as well.

No comments:

Post a Comment