Logo Search packages:      
Sourcecode: wims version File versions

synchronized void ptolemy::plot::PlotBox::read ( InputStream  in  )  throws IOException [inline]

Read commands and/or plot data from an input stream in the old (non-XML) file syntax. To update the display, call repaint(), or make the plot visible with setVisible(true).

To read from standard input, use:

     read(System.in);
  
To read from a url, use:
     read(url.openStream());
  
To read a URL from within an applet, use:
     URL url = new URL(getDocumentBase(), urlSpec);
     read(url.openStream());
  
Within an application, if you have an absolute URL, use:
     URL url = new URL(urlSpec);
     read(url.openStream());
  
To read from a file, use:
     read(new FileInputStream(filename));
  
Parameters:
in The input stream.
Exceptions:
IOException If the stream cannot be read.

Reimplemented in ptolemy::plot::Plot.

Definition at line 1088 of file PlotBox.java.

References _parseLine().

Referenced by ptolemy::plot::PlotFrame::_read(), ptolemy::plot::PlotApplet::_read(), ptolemy::plot::PlotFormatter::apply(), ptolemy::plot::PlotFormatter::PlotFormatter(), and ptolemy::plot::PlotApplet::read_from_param().

                                                                     {
        try {
            // NOTE: I tried to use exclusively the jdk 1.1 Reader classes,
            // but they provide no support like DataInputStream, nor
            // support for URL accesses.  So I use the older classes
            // here in a strange mixture.
            BufferedReader din = new BufferedReader(new InputStreamReader(in));

            try {
                String line = din.readLine();

                while (line != null) {
                    _parseLine(line);
                    line = din.readLine();
                }
            } finally {
                din.close();
            }
        } catch (IOException e) {
            _errorMsg = new String[2];
            _errorMsg[0] = "Failure reading input data.";
            _errorMsg[1] = e.getMessage();
            throw e;
        }
    }


Generated by  Doxygen 1.6.0   Back to index