Java Reference
In-Depth Information
If you need to write files in this format, everything works as you'd expect—you create a
GZipOutputStream and write on it, usually using it through a DataOutputStream ,
BufferedWriter , or PrintWriter .
See Also
InflaterInputStream , InflaterOutputStream , DeflaterInputStream , and Deflater-
OutputStream provide access to general-purpose compression and decompression; these
stream classes provide an I/O-based implementation of Inflater and Deflater .
Learning about the Communications API for Serial and
Parallel Ports
Problem
You have a computer with a serial or parallel port, and you want to read and write on such a
port.
Solution
Find an implementation of the Java Communications API ( javax.comm ) and write code us-
ing it. Get a list of Communicaton Ports, and pick one port. You can use the CommPortIden-
tifier 's open() method to get a SerialPort object.
Discussion
Peripheral devices are usually external to the computer. [ 38 ] Printers, mice, video cameras,
scanners, data/fax modems, plotters, robots, telephones, light switches, weather gauges,
smartphones, and many others exist “out there,” beyond the confines of your desktop or serv-
er machine. We need a way to reach out to them.
The Java Communications API not only gave us that but cleverly unifies the programming
model for dealing with a range of external devices. It supports both serial (RS232/434,
COM, or tty) and parallel (printer, LPT) ports.
 
Search WWH ::




Custom Search