Home : Course Map : Chapter 23 :
Parallel Port IO
JavaTech
Course Map
Chapter 23

Access Platform
System Properties
  Demo 1
Run Ext. Programs
  Demo 2
Java Comm API
Port Classes
Port Operations
  Demo 3   Demo 4   Demo 5
Serial Port IO
Demo: Serial Port
  Code Listings

    Demo 6
Parallel Port
Port I/O Apps
Exercises

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

Parallel ports are often referred to as printer ports since output to printers was their original purpose. They provide 8 lines to send 8 bits simultaneously to the device. Over time various new versions of parallel ports appeared that allowed for two way transmissions and for faster speeds. Other devices besides printers such as ZIP drives began to take advantage of this port.

However, although still available on some desktop machines, most new printers and other devices needing fast I/O come with USB or other fast port instead.

The ParallelPort class in javax.comm package allows you to open a parallel port, set the mode (such as extended or enhanced), open input and output streams, and check on the status of the port.

Generally, the class follows the printer characterization of the port. For example, it provides the methods

  void suspend()
  void restart()

for pausing and restarting transmissions as one would do to pause and restart printing. Similarly, the status check methods are

  boolean isPaperOut()
  boolean isPrinterBusy()
  boolean isPrinterSelected()
  boolean isPrinterTimedOut()
  boolean isPrinterError()

The parallel port events only fire for empty buffer output, not for the presence of input.

For futher information about parallel port I/O, we refer you to the references.

References and Web Resources

Latest update: Dec. 13, 2004

  
  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.