The Architecture of the Java Communications API

Because the Java Communications API is a standard extension, it is not installed by default with the JDK. You have to download it from http://java.sun.com/products/javacomm/ and install it separately. The current version is 3.0. However. this is only available for Linux and Solaris. Version 2.0 was also available on Windows. However, Sun recently retired that version. At the time of this writing you can find it at http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=7235-javacomm-2.0-spec-oth-JSpec&SiteId=JSC&TransactionId=noreg but I wouldn count on that URL lasting forever. If you can find a copy, the difference between 2.0 and 3.0 is not huge (with the exception of Windows support), just a couple of extra methods here and there.

There are a couple of third-party implementations of the Java Communications API for the Mac. However, since its been almost ten years since any Macs shipped with serial ports and no Mac has ever had a parallel port, this probably isn too big a deal. These days attaching a serial port device to a Mac requires a USB adapter or PCI card.


The Java Communications API contains a single package, javax.comm, which holds a bakers dozen of classes, exceptions, and interfaces. Because the Comm API is a standard extension, the javax prefix is used instead of the java prefix. The Comm API also includes a DLL or shared library containing the native code to communicate with the ports, and a few driver classes in the com.sun.comm package that mostly handle the vagaries of Unix or Wintel ports. Other vendors may need to muck around with these if they e porting the Comm API to another platform (e.g., the Mac or Pocket PC), but as a user of the API, youll only concern yourself with the documented classes in javax.comm.

javax.comm is divided into high-level and low-level classes. High-level classes are responsible for controlling access to and ownership of the communication ports and performing basic I/O. The CommPortIdentifier class lets you find and open the ports available on a system. The CommPort class provides input and output streams connected to the ports. Low-level classesSerialPort and ParallelPort, for examplemanage interaction with particular kinds of ports and help you read and write the control wires on the ports. They also provide event-based notification of changes to the state of the port.


Basic I/O

Introducing I/O

Output Streams

Input Streams

Data Sources

File Streams

Network Streams

Filter Streams

Filter Streams

Print Streams

Data Streams

Streams in Memory

Compressing Streams

JAR Archives

Cryptographic Streams

Object Serialization

New I/O

Buffers

Channels

Nonblocking I/O

The File System

Working with Files

File Dialogs and Choosers

Text

Character Sets and Unicode

Readers and Writers

Formatted I/O with java.text

Devices

The Java Communications API

USB

The J2ME Generic Connection Framework

Bluetooth

Character Sets



Java I/O
Java I/O
ISBN: 0596527500
EAN: 2147483647
Year: 2004
Pages: 244

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net