new StreamTokenizer(Reader r)


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class Main {

  public static void main(String[] av) throws IOException {
    StreamTokenizer tf = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    int i;

    while ((i = tf.nextToken()) != StreamTokenizer.TT_EOF) {
      switch (i) {
      case StreamTokenizer.TT_EOF:
        System.out.println("End of file");
        break;
      case StreamTokenizer.TT_EOL:
        System.out.println("End of line");
        break;
      case StreamTokenizer.TT_NUMBER:
        System.out.println("Number " + tf.nval);
        break;
      case StreamTokenizer.TT_WORD:
        System.out.println("Word, length " + tf.sval.length() + "->" + tf.sval);
        break;
      default:
        System.out.println("What is it? i = " + i);
      }
    }

  }
}
Home 
  Java Book 
    File Stream  

StreamTokenizer:
  1. StreamTokenizer
  2. new StreamTokenizer(Reader r)
  3. new StreamTokenizer(FileReader fileReader)
  4. StreamTokenizer: nval
  5. StreamTokenizer: ttype
  6. StreamTokenizer.TT_EOF
  7. StreamTokenizer.TT_NUMBER
  8. StreamTokenizer.TT_WORD
  9. StreamTokenizer: commentChar(int ch)
  10. StreamTokenizer: eolIsSignificant(boolean b)
  11. StreamTokenizer: lineno()
  12. StreamTokenizer: nextToken()
  13. StreamTokenizer: ordinaryChar(int ch)
  14. StreamTokenizer: wordChars((int low, int hi))