home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / INTERNET / WI9609FT.ZIP / PLANNER.JAV < prev   
Encoding:
Text File  |  1996-07-14  |  853 b   |  33 lines

  1. import java.applet.*;
  2. import java.io.*;
  3. import java.net.*;
  4.  
  5. public class planner extends Applet {
  6.    public void init() {
  7.      try {          
  8.       /* First, open the document via http. */
  9.       URL info = new URL( getDocumentBase() , "specs.dat" );   
  10.  
  11.       /* Then open the input stream. */
  12.       InputStream din = info.openStream(); 
  13.  
  14.    /* From here we can treat din just like anyother 
  15.     InputStream.  For example, the following code parses 
  16.     the text as numbers and perform some operation 
  17.     on them: */
  18.  
  19.       StreamTokenizer st =  new StreamTokenizer(din);
  20.  
  21.     while (st.nextToken() != StreamTokenizer.TT_EOF) 
  22.             performOp( st.nval );
  23.     } catch (Exception ex) {
  24.       System.out.println(ex.toString());
  25.     }
  26.   }
  27.  
  28.   private void performOp(double value)
  29.   {
  30.     System.out.println(value);
  31.   }
  32. }
  33.