Java Reference
In-Depth Information
fHistogram[i+NUM - HISTS] =
new Histogram ( " Calibrated Sensor " +i ,
" Data " , 25,0.0,10.0);
fHistPanel[i+NUM - HISTS] =
new StreamedHistPanel (fHistogram[i+NUM - HISTS]);
// Add the histogram panels to the container panel
fHistsPanel.add (fHistPanel[i+NUM - HISTS]);
// Get the output streams for each panel and wrap them
// in a filter that will calibrate the stream data.
fDataOut[i+NUM - HISTS] =
new HistFilterOutputStream (
fHistPanel[i+NUM - HISTS].getOutputStream (),
fSlope[i],fPedestal[i]);
}
...
We see that the panel setup is similar for both rows except the output stream for
the bottom row is wrapped with HistFilterOutputStream .Inthe sensor-
generating section, the loop is the same as before (except over six rather than
three histograms):
... loop to generate data for each sensor histogram ...
try {
// Send data to stream destination
dataOut[j].write (ival);
}
catch (IOException ioe) {}
...
The polymorphic feature of our objects means that the write() method for the
particular subclass of OutputStream is invoked.
9.14 More Java I/O
In the following chapters we will frequently discuss Java I/O and give a number
of examples. In Chapter 11 we discuss transmission of images over the network
and reading and writing images in disk files. The chapters of Part II involve
many aspects of I/O with other computers over network connections. Part III also
involves I/O with Chapter 23 discussing communications with external devices
via serial ports and Chapter 24 examining communications with embedded Java
devices.
 
Search WWH ::




Custom Search