Java Reference
In-Depth Information
removeFileSystemListener() method is used to deregister such a listener. Notifications from
the FileRegistry class are important for applications like when file browsers that may want to
notify the user or update the display when e.g. a memory card was inserted or removed. Whenever a
file system is added or removed, the corresponding rootAdded() or rootRemoved() callback
method is called. Both methods provide a FileSystemEvent parameter. The FileSystemEvent
is used to identify the particular file system change that occurred. The type of the event can be retrieved
using the getID() method returning one of the constants FileSystemEvent.ROOT_ADDED or
FileSystemEvent. ROOT_REMOVED . The getRootName() method allows you to query the
file system root the event is referring to.
IRDA Connections
Unfortunately, infrared connections corresponding to the IRDA standard are covered neither by the
CLDC specification nor by the MIDP or PDAP profile, except from the serial port emulation. However,
it might be possible that some devices allow mapping a serial connection to the infrared port. Also,
even if IRDA communication is currently not specified in CLDC, it might be provided by device
manufacturers, third parties or future versions of the J2ME standards.
Bluetooth Connections
A very new connection type for mobile devices is the upcoming Bluetooth technology. The Bluetooth
standard defines data exchange up to 100 meters over the air at a maximum bandwidth of 723.2kB/s.
However, in order to save battery power in mobile devices, usually the pico version of the standard is
implemented, which reduces the nominal range of the Bluetooth Communication to 10 meters.
Bluetooth might replace the IRDA communication that is often used between mobile phones, PDAs,
and notebooks because it does not need to have a direct optical connection between sender and receiver.
Thus, it would be possible to use a cell phone that is placed in the user's vest pocket to connect a PDA
to the Internet.
JSR-82 covering Bluetooth connectivity for J2SE and J2ME includes a Bluetooth integration into the
GCF. To get more information about JSR-82, it is available for public review under the following URL:
http://www.jcp.org/jsr/detail/82.jsp .
GCF Examples
Now that you know about the connection types provided by CLDC, MIDP 1.0, and 2.0, you are ready
to implement two example applications: a terminal program and a chat application. These example
applications will be CLDC-based.
GCF Terminal Program
Prior to the PC era, it was quite common to have a single centralized computer and a set of simple
hardware terminals providing text-based interfaces to the main computer. A terminal program is an
application that simulates this kind of interface by providing a local text interface to a remote process.
Before the World Wide Web became popular, terminal programs were widely used to access so-called
mailboxes or bulletin board systems (BBS) over a serial modem connection. Today, terminal programs
implementing the telnet protocol are still used for command line access; for example, for server
configuration.
For the sample terminal application, we will take advantage of the fact that the GCF is indeed very
generic. You will enter a URI, and your terminal program will connect to the given address and display
what the other end of the connection sends. For example, if you connect to an HTTP address, the
program will display the HTML code of the requested page. You may also use the example to view the
 
 
Search WWH ::




Custom Search