java.io

Class StreamTokenizer


public class StreamTokenizer
extends Object

The StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time. The parsing process is controlled by a table and a number of flags that can be set to various states. The stream tokenizer can recognize identifiers, numbers, quoted strings, and various comment styles.

Each byte read from the input stream is regarded as a character in the range '\u0000' through '\u00FF'. The character value is used to look up five possible attributes of the character: white space, alphabetic, numeric, string quote, and comment character. Each character can have zero or more of these attributes.

In addition, an instance has four flags. These flags indicate:

A typical application first constructs an instance of this class, sets up the syntax tables, and then repeatedly loops calling the nextToken method in each iteration of the loop until it returns the value TT_EOF.

Since:
JDK1.0
See Also:
nextToken(), TT_EOF

Field Summary

static int
TT_EOF
A constant indicating that the end of the stream has been read.
static int
TT_EOL
A constant indicating that the end of the line has been read.
static int
TT_NUMBER
A constant indicating that a number token has been read.
static int
TT_WORD
A constant indicating that a word token has been read.
double
nval
If the current token is a number, this field contains the value of that number.
String
sval
If the current token is a word token, this field contains a string giving the characters of the word token.
int
ttype
After a call to the nextToken method, this field contains the type of the token just read.

Constructor Summary

StreamTokenizer(Reader r)
Create a tokenizer that parses the given character stream.

Method Summary

void
commentChar(int ch)
Specified that the character argument starts a single-line comment.
void
eolIsSignificant(boolean flag)
Determines whether or not ends of line are treated as tokens.
int
lineno()
Return the current line number.
void
lowerCaseMode(boolean fl)
Determines whether or not word token are automatically lowercased.
int
nextToken()
Parses the next token from the input stream of this tokenizer.
void
ordinaryChar(int ch)
Specifies that the character argument is "ordinary" in this tokenizer.
void
ordinaryChars(int low, int hi)
Specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer.
void
parseNumbers()
Specifies that numbers should be parsed by this tokenizer.
void
pushBack()
Causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field.
void
quoteChar(int ch)
Specifies that matching pairs of this character delimit string constants in this tokenizer.
void
resetSyntax()
Resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary.
void
slashSlashComments(boolean flag)
Determines whether or not the tokenizer recognizes C++-style comments.
void
slashStarComments(boolean flag)
Determines whether or not the tokenizer recognizes C-style comments.
String
toString()
Returns the string representation of the current stream token and the line number it occurs on.
void
whitespaceChars(int low, int hi)
Specifies that all characters c in the range low <= c <= high are white space characters.
void
wordChars(int low, int hi)
Specifies that all characters c in the range low <= c <= high are word constituents.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

TT_EOF

public static final int TT_EOF
A constant indicating that the end of the stream has been read.
Field Value:
-1
Usages and Demos :

View More Examples of StreamTokenizer.TT_EOF
   1:     break;
   2:       case StreamTokenizer.TT_EOF:
   3:     System.out.println("[TT_EOF]");
   4:         ...
   5:       }
   6:     } while (t != StreamTokenizer.TT_EOF);
   7:   }
   8:   
   9:   public static void main(String[] args) {

View Full Code Here
   1:             switch(i) {
   2:             case StreamTokenizer.TT_EOF:
   3:                 System.out.println("End of file");
   4:                 break;
   5:             case StreamTokenizer.TT_EOL:

View Full Code Here
   1:         switch (t) {
   2:         case StreamTokenizer.TT_EOF:
   3:         c = ct.getCount();
   4:         System.out.println(l + "\t" + w + "\t" + c + "\t" + name);
   5:         tc += c;

View Full Code Here
   1:         switch (st_.ttype) {
   2:           case StreamTokenizer.TT_EOF :
   3:             r= "";
   4:             break;
   5:           case StreamTokenizer.TT_WORD :

View Full Code Here
   1:       while(dataNaTokeny.nextToken() !=
   2:         StreamTokenizer.TT_EOF) {
   3:         String retezec;
   4:         switch(dataNaTokeny.ttype) {
   5:           case StreamTokenizer.TT_EOL:

View Full Code Here

TT_EOL

public static final int TT_EOL
A constant indicating that the end of the line has been read.
Field Value:
10
Usages and Demos :

View More Examples of StreamTokenizer.TT_EOL
   1:     break;
   2:       case StreamTokenizer.TT_EOL:
   3:     System.out.println("[TT_EOL]");
   4:     break;
   5:       case StreamTokenizer.TT_EOF:

View Full Code Here
   1:         switch(st.ttype) {
   2:           case StreamTokenizer.TT_EOL:
   3:             s = null;
   4:             break;
   5:           case StreamTokenizer.TT_NUMBER:

View Full Code Here
   1:         switch(st.ttype) {
   2:           case StreamTokenizer.TT_EOL:
   3:             s = null;
   4:             break;
   5:           case StreamTokenizer.TT_NUMBER:

View Full Code Here
   1:                 break;
   2:             case StreamTokenizer.TT_EOL:
   3:                 System.out.println("End of line");
   4:                 break;
   5:             case StreamTokenizer.TT_NUMBER:

View Full Code Here

TT_NUMBER

public static final int TT_NUMBER
A constant indicating that a number token has been read.
Field Value:
-2
Usages and Demos :

View More Examples of StreamTokenizer.TT_NUMBER
   1:     break;
   2:       case StreamTokenizer.TT_NUMBER:
   3:     System.out.println("[TT_NUMBER]: " + st.nval);
   4:     break;
   5:       case StreamTokenizer.TT_EOL:

View Full Code Here
   1:             break;
   2:           case StreamTokenizer.TT_NUMBER:
   3:             s = Double.toString(st.nval);
   4:             break;
   5:           case StreamTokenizer.TT_WORD:

View Full Code Here

TT_WORD

public static final int TT_WORD
A constant indicating that a word token has been read.
Field Value:
-3
Usages and Demos :

View More Examples of StreamTokenizer.TT_WORD
   1:       switch (t) {
   2:       case StreamTokenizer.TT_WORD:
   3:     System.out.println("[TT_WORD]: " + st.sval);
   4:     break;
   5:       case StreamTokenizer.TT_NUMBER:

View Full Code Here
   1:             break;
   2:           case StreamTokenizer.TT_WORD:
   3:             s = new String(st.sval);
   4:             break;
   5:             s = String.valueOf((char)st.ttype);

View Full Code Here

nval

public double nval
If the current token is a number, this field contains the value of that number. The current token is a number when the value of the ttype field is TT_NUMBER.

The initial value of this field is 0.0.

See Also:
TT_NUMBER, ttype
Usages and Demos :

View More Examples of nval
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   6:         switch(st.ttype) {
   7:         ...
   8:             System.out.println(st.lineno() + ") " + 
   9:               st.nval);
  10:             break;

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5: 
   6:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   7:         switch(st.ttype) {
   8:         ...
   9:             System.out.println(st.lineno() + ") " + 
  10:               st.nval);
  11:             break;

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5: 
   6:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   7:         switch(st.ttype) {
   8:         ...
   9:             System.out.println(st.lineno() + ") " + 
  10:               st.nval);
  11:             break;

View Full Code Here
   1:       rc = new ReadConfidence();
   2:       StreamTokenizer tokens = new StreamTokenizer(in);
   3:       int tok;
   4:         ...
   5:       while ( StreamTokenizer.TT_NUMBER == ( tok = tokens.nextToken() ) ) {
   6:         ...
   7:         rc.addBaseConfidence(new BaseConfidence('N', new Double(tokens.nval).intValue()));
   8:       }

View Full Code Here
   1: import java.io.StreamTokenizer;
   2: import java.io.BufferedReader;
   3:         ...
   4: 
   5:     if (tokenizer.nval > (double) Integer.MAX_VALUE 
   6:         ...
   7:             || tokenizer.nval < (double) Integer.MIN_VALUE) {
   8:       throw new InvalidUserInputException(" readInt() failed. " 
   9:         ...
  10: 
  11:     if (tokenizer.nval != (double) (int) tokenizer.nval) {

View Full Code Here

sval

public String sval
If the current token is a word token, this field contains a string giving the characters of the word token. When the current token is a quoted string token, this field contains the body of the string.

The current token is a word when the value of the ttype field is TT_WORD. The current token is a quoted string token when the value of the ttype field is a quote character.

The initial value of this field is null.

Usages and Demos :

View More Examples of sval
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   6:         switch(st.ttype) {
   7:         ...
   8:             System.out.println(st.lineno() + ") " +
   9:               st.sval);
  10:             break;

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5: 
   6:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   7:         switch(st.ttype) {
   8:         ...
   9:             System.out.println(st.lineno() + ") " +
  10:               st.sval);
  11:             break;

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5: 
   6:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   7:         switch(st.ttype) {
   8:         ...
   9:             System.out.println(st.lineno() + ") " + 
  10:               st.sval);
  11:             break;

View Full Code Here
   1:     stok.wordChars('.', 'z');
   2:     while(stok.nextToken() != StreamTokenizer.TT_EOF) {
   3:         switch (stok.ttype) {
   4:         ...
   5:             case StreamTokenizer.TT_EOL : out("Oops, EOL token!"); break;
   6:         ...
   7:             case StreamTokenizer.TT_NUMBER : out("Oops, number!"); break;
   8:         ...
   9:             case StreamTokenizer.TT_WORD : loadPlugin(ucl, stok.sval); break;

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new InputStreamReader
   7:                    (AglPatronType.class.getResourceAsStream
   8:         ...
   9:       {
  10:             case StreamTokenizer.TT_EOL   : r="$";               break;
  11:             case StreamTokenizer.TT_EOF   : r="";                break;
  12:         ...
  13:             case StreamTokenizer.TT_WORD  : r=st.sval;           break;

View Full Code Here

ttype

public int ttype
After a call to the nextToken method, this field contains the type of the token just read. For a single character token, its value is the single character, converted to an integer. For a quoted string token (see , its value is the quote character. Otherwise, its value is one of the following:
  • TT_WORD indicates that the token is a word.
  • TT_NUMBER indicates that the token is a number.
  • TT_EOL indicates that the end of line has been read. The field can only have this value if the eolIsSignificant method has been called with the argument true.
  • TT_EOF indicates that the end of the input stream has been reached.

The initial value of this field is -4.

Usages and Demos :

View More Examples of ttype
   1:         {
   2:     private StreamTokenizer st;
   3:     private StringBuffer buffer = new StringBuffer("");
   4:         ...
   5:                 {
   6:         st = new StreamTokenizer(new InputStreamReader(is));
   7:         scan();
   8:         ...
   9:                 {
  10:         st = new StreamTokenizer(r);
  11:         scan();
  12:         ...
  13:                 {
  14:                 if ((st.ttype == StreamTokenizer.TT_WORD)

View Full Code Here
   1:   Reader reader;
   2:   public StreamTokenizer stok;
   3:   Error err = new Error();
   4:         ...
   5:     reader = new StringReader (s);
   6:     stok = new StreamTokenizer (reader);
   7:     stok.wordChars ('_', '_');
   8:         ...
   9:   public int ttype() {
  10:     return stok.ttype;
  11:   }
  12:         ...
  13:   public boolean isQString() {
  14:     return ((stok.sval != null) && (stok.ttype > 0));

View Full Code Here
   1:   Reader reader;
   2:   public StreamTokenizer stok;
   3:   Error err = new Error();
   4:         ...
   5:     reader = new StringReader (s);
   6:     stok = new StreamTokenizer (reader);
   7:     stok.wordChars ('_', '_');
   8:         ...
   9:   public int ttype() {
  10:     return stok.ttype;
  11:   }
  12:         ...
  13:   public boolean isQString() {
  14:     return ((stok.sval != null) && (stok.ttype > 0));

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.ArrayList;
   4:         ...
   5:     private List            columnNames;
   6:     private StreamTokenizer tokenizer;
   7:     private ValueParser     lineValues;
   8:         ...
   9:         
  10:         tokenizer = new StreamTokenizer(new BufferedReader(in));
  11:         initTokenizer(tokenizer);
  12:         ...
  13:         tokenizer.nextToken();
  14:         while (tokenizer.ttype == StreamTokenizer.TT_WORD

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.ArrayList;
   4:         ...
   5: 
   6:     private StreamTokenizer tokenizer;
   7: 
   8:         ...
   9: 
  10:         tokenizer = new StreamTokenizer(new BufferedReader(in));
  11:         initTokenizer(tokenizer);
  12:         ...
  13:         tokenizer.nextToken();
  14:         while (tokenizer.ttype == StreamTokenizer.TT_WORD

View Full Code Here

Constructor Details

StreamTokenizer

public StreamTokenizer(Reader r)
Create a tokenizer that parses the given character stream.
Parameters:
r - a Reader object providing the input stream.
Since:
JDK1.1
Usages and Demos :

View More Examples of StreamTokenizer(Reader r)
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:       st.eolIsSignificant(true);

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
   5:         switch(st.ttype) {

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:       st.whitespaceChars(',', ',');

View Full Code Here
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:       st.ordinaryChar('.');

View Full Code Here
   1:     public ScanStreamTok(Reader rdr) throws IOException {
   2:         tf = new StreamTokenizer(rdr);
   3:     }
   4: 
   5:     protected void process() throws IOException {

View Full Code Here

Method Details

commentChar

public void commentChar(int ch)
Specified that the character argument starts a single-line comment. All characters from the comment character to the end of the line are ignored by this stream tokenizer.

Any other attribute settings for the specified character are cleared.

Parameters:
ch - the character.
Usages and Demos :

View More Examples of commentChar(int ch)
   1:         Reader r = new BufferedReader(new FileReader(name));
   2:         StreamTokenizer st = new StreamTokenizer(r);
   3:         st.resetSyntax();
   4:         ...
   5:         st.whitespaceChars(0, ' ');
   6:         st.commentChar('#');
   7:         st.quoteChar('\"');
   8:         st.quoteChar('\'');
   9:         while(st.nextToken()!=st.TT_EOF)

View Full Code Here
   1: import java.io.BufferedReader;
   2: import java.io.StreamTokenizer;
   3: import com.sun.tools.javac.util.ListBuffer;
   4:         ...
   5:     Reader r = new BufferedReader(new FileReader(name));
   6:     StreamTokenizer st = new StreamTokenizer(r);
   7:     st.resetSyntax();
   8:         ...
   9:     st.whitespaceChars(0, ' ');
  10:     st.commentChar('#');
  11:     st.quoteChar('"');

View Full Code Here
   1:     Reader r = new BufferedReader(new InputStreamReader(serviceis, "UTF-8"));
   2:     stok.commentChar('#');
   3:     stok.eolIsSignificant(false);
   4:         ...
   5:     stok.wordChars('.', 'z');
   6:     while(stok.nextToken() != StreamTokenizer.TT_EOF) {
   7:         switch (stok.ttype) {
   8:         ...
   9:             case StreamTokenizer.TT_EOL : out("Oops, EOL token!"); break;
  10:         ...
  11:             case StreamTokenizer.TT_NUMBER : out("Oops, number!"); break;

View Full Code Here
   1:   Reader reader;
   2:   public StreamTokenizer stok;
   3:   Error err = new Error();
   4:         ...
   5:     reader = new StringReader (s);
   6:     stok = new StreamTokenizer (reader);
   7:     stok.wordChars ('_', '_');
   8:         ...
   9:   public void commentChar (int ch) {
  10:     stok.commentChar(ch);
  11:   }

View Full Code Here
   1:   Reader reader;
   2:   public StreamTokenizer stok;
   3:   Error err = new Error();
   4:         ...
   5:     reader = new StringReader (s);
   6:     stok = new StreamTokenizer (reader);
   7:     stok.wordChars ('_', '_');
   8:         ...
   9:   public void commentChar (int ch) {
  10:     stok.commentChar(ch);
  11:   }

View Full Code Here

eolIsSignificant

public void eolIsSignificant(boolean flag)
Determines whether or not ends of line are treated as tokens. If the flag argument is true, this tokenizer treats end of lines as tokens; the nextToken method returns TT_EOL and also sets the ttype field to this value when an end of line is read.

A line is a sequence of characters ending with either a carriage-return character ('\r') or a newline character ('\n'). In addition, a carriage-return character followed immediately by a newline character is treated as a single end-of-line token.

If the flag is false, end-of-line characters are treated as white space and serve only to separate tokens.

Parameters:
flag - true indicates that end-of-line characters are separate tokens; false indicates that end-of-line characters are white space.
Usages and Demos :

View More Examples of eolIsSignificant(boolean flag)
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5:       st.eolIsSignificant(true);
   6: 
   7:         ...
   8: 
   9:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
  10:         switch(st.ttype) {

View Full Code Here
   1:             FileReader fr =new FileReader(rootdir+fileroot+"."+quantity[q]); 
   2:             StreamTokenizer st=new StreamTokenizer(fr); 
   3:         ...
   4:             st.eolIsSignificant(true); 
   5:             
   6:             for (int m=0; m<mon; m++) {
   7:                 

View Full Code Here
   1:     
   2:         StreamTokenizer st=new StreamTokenizer(fr); 
   3:         ...
   4:         st.eolIsSignificant(true);
   5:         
   6:         ...
   7:         while ((t=st.nextToken())!=StreamTokenizer.TT_EOF) {
   8:             if (t==st.TT_EOL) ok=true; 

View Full Code Here
   1:             FileReader fr =new FileReader(rootdir+"..\\ddc\\model\\"+fileroot+"."+quantity[q]); 
   2:             StreamTokenizer st=new StreamTokenizer(fr); 
   3:         ...
   4:             st.eolIsSignificant(true); 
   5:             
   6:             for (int m=0; m<mon; m++) {
   7:                 

View Full Code Here
   1:     counter ct = new counter(in);
   2:     StreamTokenizer s = new StreamTokenizer(new InputStreamReader(ct));
   3:     s.resetSyntax();
   4:         ...
   5:     s.whitespaceChars('\t', '\t');
   6:     s.eolIsSignificant(true);
   7: 
   8:         ...
   9:         switch (t) {
  10:         case StreamTokenizer.TT_EOF:
  11:         c = ct.getCount();

View Full Code Here

lineno

public int lineno()
Return the current line number.
Returns:
the current line number of this stream tokenizer.
Usages and Demos :

View More Examples of lineno()
   1: 
   2:     final StreamTokenizer izer;
   3:     static final int DEFINE_TOKEN = 101010;
   4:         ...
   5:     int tok;
   6:     int prevTok = StreamTokenizer.TT_EOL;
   7:     String origName;
   8:         ...
   9:     JVMDIParse(Reader reader) throws IOException {
  10:         izer = new StreamTokenizer(new BufferedReader(reader));
  11:         izer.resetSyntax();
  12:         ...
  13:     void error(String errmsg) {
  14:         System.err.println("JVMDI:" + izer.lineno() + 

View Full Code Here
   1: 
   2:     final StreamTokenizer izer;
   3:     final Map kindMap = new HashMap();
   4:         ...
   5:     Parse(Reader reader) {
   6:         izer = new StreamTokenizer(new BufferedReader(reader));
   7:         izer.resetSyntax();
   8:         ...
   9:         
  10:         while (izer.nextToken() != StreamTokenizer.TT_EOF) {
  11:             izer.pushBack();
  12:         ...
  13:                             Node node = (Node)proto.getClass().newInstance();
  14:                             node.set(kind, list, izer.lineno());

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.StreamTokenizer;
   3: import java.io.IOException;
   4:         ...
   5:     String fname;
   6:     StreamTokenizer in;
   7:     ClassFileFinder finder;
   8:         ...
   9:     fname = name;
  10:     in = new StreamTokenizer(
  11:         new java.io.BufferedInputStream(
  12:         ...
  13:                 "memberloader.dependence_file_error_near_line", 
  14:                  fname, Integer.toString(in.lineno()));

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.lang.reflect.Constructor;
   4:         ...
   5:   private final static char SEMICOLON = ';';
   6:   private final StreamTokenizer tokenizer;
   7:   private final Stack valueStack = new Stack();
   8:         ...
   9:     int token = tokenizer.nextToken();
  10:     if (token != StreamTokenizer.TT_WORD ||
  11:         (! tokenizer.sval.equalsIgnoreCase("grant"))) {
  12:         ...
  13:       Object[] args =
  14:           new Object[]{ "\"grant\"", new Integer(tokenizer.lineno())};

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.lang.reflect.Constructor;
   4:         ...
   5:   private final static char SEMICOLON = ';';
   6:   private final StreamTokenizer tokenizer;
   7:   private final Stack valueStack = new Stack();
   8:         ...
   9:     valueStack.push(new HashMap());
  10:     for (int type = tokenizer.nextToken();type != StreamTokenizer.TT_EOF;
  11:         type = tokenizer.nextToken()) {
  12:         ...
  13:       throw new IllegalStateException("can not load class [" +
  14:           tokenizer.sval + "], at line " + tokenizer.lineno());

View Full Code Here

lowerCaseMode

public void lowerCaseMode(boolean fl)
Determines whether or not word token are automatically lowercased. If the flag argument is true, then the value in the sval field is lowercased whenever a word token is returned (the ttype field has the value TT_WORD by the nextToken method of this tokenizer.

If the flag argument is false, then the sval field is not modified.

Parameters:
fl - true indicates that all word tokens should be lowercased.
Usages and Demos :

View More Examples of lowerCaseMode(boolean fl)
   1: {
   2:   System.out.println("Started test of StreamTokenizer");
   3:   
   4:         ...
   5: 
   6:       StreamTokenizer st = new StreamTokenizer(new 
   7:                                FileInputStream("./stream-tokenizer.data"));
   8:         ...
   9:                     st.eolIsSignificant(true);
  10:                     st.lowerCaseMode(true);
  11:                     st.slashStarComments(true);

View Full Code Here
   1:   static final boolean DEBUG = true;
   2:   StreamTokenizer in;
   3: 
   4:         ...
   5:   Lisp(InputStream is) {
   6:     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
   7:     in.resetSyntax();
   8:         ...
   9: 
  10:     for (in.nextToken(); in.ttype!=StreamTokenizer.TT_EOF; in.nextToken()) {
  11:       switch (in.ttype) {

View Full Code Here
   1:     stok.eolIsSignificant(false);
   2:     stok.lowerCaseMode(false);
   3:     stok.wordChars('.', 'z');
   4:         ...
   5:     while(stok.nextToken() != StreamTokenizer.TT_EOF) {
   6:         switch (stok.ttype) {
   7:         ...
   8:             case StreamTokenizer.TT_EOL : out("Oops, EOL token!"); break;
   9:         ...
  10:             case StreamTokenizer.TT_NUMBER : out("Oops, number!"); break;

View Full Code Here
   1: import java.io.FileReader;
   2: import java.io.StreamTokenizer;
   3: import java.io.IOException;
   4:         ...
   5:    {
   6:       StreamTokenizer tokens = createTokenizer(input);
   7: 
   8:         ...
   9:       int tok = tokens.nextToken();
  10:       if (tok == StreamTokenizer.TT_EOF)
  11:          return null;
  12:         ...
  13:       tokens.slashStarComments(false);
  14:       tokens.lowerCaseMode(false);

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.net.MalformedURLException;
   4:         ...
   5:         FileReader fs = new FileReader( html);
   6:         StreamTokenizer st = new StreamTokenizer( fs);
   7: 
   8:         ...
   9:         st.lowerCaseMode( true);
  10:         st.ordinaryChar('/');
  11:         ...
  12:             if ( st.sval.equals("codebase") ) {
  13:                 st.lowerCaseMode( false);

View Full Code Here

nextToken

public int nextToken()
            throws IOException
Parses the next token from the input stream of this tokenizer. The type of the next token is returned in the ttype field. Additional information about the token may be in the nval field or the sval field of this tokenizer.

Typical clients of this class first set up the syntax tables and then sit in a loop calling nextToken to parse successive tokens until TT_EOF is returned.

Returns:
the value of the ttype field.
Throws:
IOException - if an I/O error occurs.
See Also:
nval, sval, ttype
Usages and Demos :

View More Examples of nextToken()
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.io.StringReader;
   4:         ...
   5:     StringReader reader = new StringReader(str);
   6:     StreamTokenizer st = new StreamTokenizer(reader);
   7:     int t = 0;
   8:         ...
   9:     do {
  10:       t = st.nextToken();
  11:       

View Full Code Here
   1:             FileReader fr =new FileReader(rootdir+fileroot+"."+quantity[q]); 
   2:             StreamTokenizer st=new StreamTokenizer(fr); 
   3:             st.eolIsSignificant(true); 
   4:         ...
   5:                 
   6:                 for (int i=0; i<6 ; i++) while (st.nextToken()!=st.TT_EOL) {    }
   7:                 
   8:         ...
   9:                 }
  10:                 st.nextToken(); 
  11:             }

View Full Code Here
   1:             FileReader fr =new FileReader(rootdir+"..\\ddc\\model\\"+fileroot+"."+quantity[q]); 
   2:             StreamTokenizer st=new StreamTokenizer(fr); 
   3:             st.eolIsSignificant(true); 
   4:         ...
   5:                 
   6:                 for (int i=0; i<6 ; i++) while (st.nextToken()!=st.TT_EOL) {    }
   7:                 
   8:         ...
   9:                 }
  10:                 st.nextToken(); 
  11:             }

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:     st_.resetSyntax();
  12:         ...
  13:       try {
  14:         st_.nextToken();

View Full Code Here
   1:   private FileReader soubor;
   2:   private StreamTokenizer dataNaTokeny;
   3:   private TreeMap pocty = new TreeMap();
   4:         ...
   5:       soubor = new FileReader(nazevSouboru);
   6:       dataNaTokeny = new StreamTokenizer(
   7:         new BufferedReader(soubor));
   8:         ...
   9:     try {
  10:       while(dataNaTokeny.nextToken() !=
  11:         ...
  12:         StreamTokenizer.TT_EOF) {

View Full Code Here

ordinaryChar

public void ordinaryChar(int ch)
Specifies that the character argument is "ordinary" in this tokenizer. It removes any special significance the character has as a comment character, word component, string delimiter, white space, or number character. When such a character is encountered by the parser, the parser treats it as a single-character token and sets ttype field to the character value.

Making a line terminator character "ordinary" may interfere with the ability of a StreamTokenizer to count lines. The lineno method may no longer reflect the presence of such terminator characters in its line count.

Parameters:
ch - the character.
See Also:
ttype
Usages and Demos :

View More Examples of ordinaryChar(int ch)
   1: 
   2:       StreamTokenizer st = new StreamTokenizer(br);
   3: 
   4:         ...
   5:       st.ordinaryChar('.');
   6: 
   7:         ...
   8: 
   9:       while(st.nextToken() != StreamTokenizer.TT_EOF) {
  10:         switch(st.ttype) {

View Full Code Here
   1: public class StripQualifiers {
   2:   private StreamTokenizer st;
   3:   public StripQualifiers(String qualified) {
   4:         ...
   5:     st = new StreamTokenizer(
   6:       new StringReader(qualified));
   7:         ...
   8:       int token = st.nextToken();
   9:       if(token != StreamTokenizer.TT_EOF) {
  10:         switch(st.ttype) {

View Full Code Here
   1: public class StripQualifiers {
   2:   private StreamTokenizer st;
   3:   public StripQualifiers(String qualified) {
   4:         ...
   5:     st = new StreamTokenizer(
   6:       new StringReader(qualified));
   7:         ...
   8:       int token = st.nextToken();
   9:       if(token != StreamTokenizer.TT_EOF) {
  10:         switch(st.ttype) {

View Full Code Here
   1:   private FileReader soubor;
   2:   private StreamTokenizer dataNaTokeny;
   3:   private TreeMap pocty = new TreeMap();
   4:         ...
   5:       soubor = new FileReader(nazevSouboru);
   6:       dataNaTokeny = new StreamTokenizer(
   7:         new BufferedReader(soubor));
   8:         ...
   9:       dataNaTokeny.ordinaryChar('.');
  10:         ...
  11:       dataNaTokeny.ordinaryChar('-');

View Full Code Here
   1:   private FileInputStream file;
   2:   private StreamTokenizer st;
   3:   private Hashtable counts = new Hashtable();
   4:         ...
   5:       file = new FileInputStream(filename);
   6:       st = new StreamTokenizer(file);
   7:         ...
   8:       st.ordinaryChar('.');
   9:         ...
  10:       st.ordinaryChar('-');

View Full Code Here

ordinaryChars

public void ordinaryChars(int low,
                          int hi)
Specifies that all characters c in the range low <= c <= high are "ordinary" in this tokenizer. See the ordinaryChar method for more information on a character being ordinary.
Parameters:
low - the low end of the range.
hi - the high end of the range.
Usages and Demos :

View More Examples of ordinaryChars(int low,int hi)
   1:     Vector results = new Vector();
   2:     StreamTokenizer toks = new StreamTokenizer(chars);
   3:     String line, id, name, residues;
   4:         ...
   5:     Sequence seq;
   6:     toks.ordinaryChars('0', '9');
   7:     toks.wordChars('!', '~');
   8:         ...
   9:     int tok;
  10:     while (StreamTokenizer.TT_EOF != (tok = toks.nextToken())) {
  11:       if (StreamTokenizer.TT_WORD == tok) {

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.StreamTokenizer;
   3: 
   4:         ...
   5: 
   6:   private StreamTokenizer st;
   7: 
   8:         ...
   9:   public AkentiInputStream(InputStream is) {
  10:     st = new StreamTokenizer(this.is = is);
  11:   }
  12:         ...
  13:     for (int i=0; i < ordinaryChars.length; i++) {
  14:       st.ordinaryChars(ordinaryChars[i][0], ordinaryChars[i][1]);

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.List;
   4:         ...
   5: 
   6:     protected void initTokenizer(StreamTokenizer tokenizer)
   7:     {
   8:         ...
   9:         tokenizer.ordinaryChars('0', '9');
  10:         ...
  11:         tokenizer.ordinaryChars('-', '-');

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.List;
   4:         ...
   5: 
   6:     protected void initTokenizer(StreamTokenizer tokenizer)
   7:     {
   8:         ...
   9:         tokenizer.ordinaryChars('0', '9');
  10:         ...
  11:         tokenizer.ordinaryChars('-', '-');

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.List;
   4:         ...
   5: 
   6:     protected void initTokenizer(StreamTokenizer tokenizer)
   7:     {
   8:         ...
   9:         tokenizer.ordinaryChars('0', '9');
  10:         ...
  11:         tokenizer.ordinaryChars('-', '-');

View Full Code Here

parseNumbers

public void parseNumbers()
Specifies that numbers should be parsed by this tokenizer. The syntax table of this tokenizer is modified so that each of the twelve characters:
      0 1 2 3 4 5 6 7 8 9 . -
 

has the "numeric" attribute.

When the parser encounters a word token that has the format of a double precision floating-point number, it treats the token as a number rather than a word, by setting the ttype field to the value TT_NUMBER and putting the numeric value of the token into the nval field.

See Also:
nval, TT_NUMBER, ttype
Usages and Demos :

View More Examples of parseNumbers()
   1:   static final boolean DEBUG = true;
   2:   StreamTokenizer in;
   3: 
   4:         ...
   5:   Lisp(InputStream is) {
   6:     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
   7:     in.resetSyntax();
   8:         ...
   9:     in.parseNumbers();
  10:     in.quoteChar('"');
  11:         ...
  12: 
  13:     for (in.nextToken(); in.ttype!=StreamTokenizer.TT_EOF; in.nextToken()) {

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: 
   4:         ...
   5: {
   6:   StreamTokenizer input = null;
   7: 
   8:         ...
   9:   {
  10:     input = new StreamTokenizer(r);
  11:     input.resetSyntax();
  12:         ...
  13:     input.eolIsSignificant(true);
  14:     input.parseNumbers();

View Full Code Here
   1:          throws IOException, IllegalSymbolException, IllegalAlphabetException {
   2:     StreamTokenizer st = new StreamTokenizer(
   3:       new BufferedReader(new InputStreamReader(is)));
   4:         ...
   5:     st.wordChars('*', '*');
   6:     st.parseNumbers();
   7: 
   8:     SymbolList sym = null;

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.StreamTokenizer;
   3: 
   4:         ...
   5: 
   6:   private StreamTokenizer st;
   7: 
   8:         ...
   9:   public AkentiInputStream(InputStream is) {
  10:     st = new StreamTokenizer(this.is = is);
  11:   }
  12:         ...
  13:   public double readDouble() throws IOException {
  14:     st.parseNumbers();

View Full Code Here
   1:     String infileName, outfileName;
   2:     StreamTokenizer inp;
   3: 
   4:         ...
   5:     if (argv.length == 0)
   6:       inp = new StreamTokenizer(System.in);
   7:     else
   8:         ...
   9:       inp =
  10:         new StreamTokenizer
  11:         (new BufferedInputStream
  12:         ...
  13:     inp.commentChar(';');
  14:     inp.parseNumbers();

View Full Code Here

pushBack

public void pushBack()
Causes the next call to the nextToken method of this tokenizer to return the current value in the ttype field, and not to modify the value in the nval or sval field.
Usages and Demos :

View More Examples of pushBack()
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.net.URL;
   4:         ...
   5: 
   6:   protected SeqFeatureI parseLocation(StreamTokenizer toks, String theFeatureType)
   7:     throws IOException
   8:         ...
   9:     int tok = toks.nextToken();
  10:     if (StreamTokenizer.TT_WORD == tok && 'a' <= toks.sval.charAt(0)) {
  11:       tok = toks.nextToken();
  12:         ...
  13:     else {
  14:       toks.pushBack();

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.net.URL;
   4:         ...
   5: 
   6:   protected SeqFeatureI parseLocation(StreamTokenizer toks, String theFeatureType)
   7:     throws IOException
   8:         ...
   9:     int tok = toks.nextToken();
  10:     if (StreamTokenizer.TT_WORD == tok && toks.sval.equals("complement")) {
  11:       tok = toks.nextToken();
  12:         ...
  13:     else {
  14:       toks.pushBack();

View Full Code Here
   1:   static final boolean DEBUG = true;
   2:   StreamTokenizer in;
   3: 
   4:         ...
   5:   Lisp(InputStream is) {
   6:     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
   7:     in.resetSyntax();
   8:         ...
   9: 
  10:     for (in.nextToken(); in.ttype!=StreamTokenizer.TT_EOF; in.nextToken()) {
  11:       switch (in.ttype) {
  12:         ...
  13:       case '(':
  14:         in.pushBack(); list.add(parse(level+1));

View Full Code Here
   1: import java.io.IOException;
   2: import java.io.StreamTokenizer;
   3: import java.util.Hashtable;
   4:         ...
   5: 
   6:   protected void parseLine(int theLineNumber, StreamTokenizer theTokens)
   7:     throws IOException
   8:         ...
   9: 
  10:   protected void parseFeatureType(StreamTokenizer theTokens)
  11:     throws IOException
  12:         ...
  13:       default:
  14:         theTokens.pushBack();

View Full Code Here
   1: import java.util.Vector;
   2: import java.io.StreamTokenizer;
   3: import java.io.StringReader;
   4:         ...
   5: 
   6:     StreamTokenizer in = null;
   7:     
   8:         ...
   9:         try { 
  10:             in = new StreamTokenizer(new StringReader(s));
  11:             
  12:         ...
  13:         int t = in.nextToken(); 
  14:         in.pushBack();

View Full Code Here

quoteChar

public void quoteChar(int ch)
Specifies that matching pairs of this character delimit string constants in this tokenizer.

When the nextToken method encounters a string constant, the ttype field is set to the string delimiter and the sval field is set to the body of the string.

If a string quote character is encountered, then a string is recognized, consisting of all characters after (but not including) the string quote character, up to (but not including) the next occurrence of that same string quote character, or a line terminator, or end of file. The usual escape sequences such as "\n" and "\t" are recognized and converted to single characters as the string is parsed.

Any other attribute settings for the specified character are cleared.

Parameters:
ch - the character.
Usages and Demos :

View More Examples of quoteChar(int ch)
   1:         Reader r = new BufferedReader(new FileReader(name));
   2:         StreamTokenizer st = new StreamTokenizer(r);
   3:         st.resetSyntax();
   4:         ...
   5:         st.commentChar('#');
   6:         st.quoteChar('\"');
   7:         ...
   8:         st.quoteChar('\'');
   9:         while(st.nextToken()!=st.TT_EOF)

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:     st_.resetSyntax();
  12:         ...
  13:     st_.eolIsSignificant(false);
  14:     st_.quoteChar('"');

View Full Code Here
   1: import java.io.BufferedReader;
   2: import java.io.StreamTokenizer;
   3: import com.sun.tools.javac.util.ListBuffer;
   4:         ...
   5:     Reader r = new BufferedReader(new FileReader(name));
   6:     StreamTokenizer st = new StreamTokenizer(r);
   7:     st.resetSyntax();
   8:         ...
   9:     st.commentChar('#');
  10:     st.quoteChar('"');
  11:         ...
  12:     st.quoteChar('\'');

View Full Code Here
   1:   static final boolean DEBUG = true;
   2:   StreamTokenizer in;
   3: 
   4:         ...
   5:   Lisp(InputStream is) {
   6:     in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is)));
   7:     in.resetSyntax();
   8:         ...
   9:     in.parseNumbers();
  10:     in.quoteChar('"');
  11:     in.whitespaceChars(0,' ');
  12:         ...
  13: 
  14:     for (in.nextToken(); in.ttype!=StreamTokenizer.TT_EOF; in.nextToken()) {

View Full Code Here
   1:     int tok = 0;
   2:     StreamTokenizer tokens;
   3:     InputStream prefs_stream;
   4:         ...
   5:             Reader r = new BufferedReader(new InputStreamReader(prefs_stream));
   6:             tokens = new StreamTokenizer(r);
   7:             tokens.eolIsSignificant(false);
   8:         ...
   9:             tokens.quoteChar('"');
  10:             }
  11:         ...
  12:         try {
  13:             while ((tok = tokens.nextToken()) != StreamTokenizer.TT_EOF)

View Full Code Here

resetSyntax

public void resetSyntax()
Resets this tokenizer's syntax table so that all characters are "ordinary." See the ordinaryChar method for more information on a character being ordinary.
Usages and Demos :

View More Examples of resetSyntax()
   1: 
   2: import java.io.StreamTokenizer;
   3: import java.io.BufferedReader;
   4:         ...
   5:     char separator = ',';
   6:     StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new StringReader(str)));
   7:         ...
   8:     tokenizer.resetSyntax();              
   9:   

View Full Code Here
   1:         Reader r = new BufferedReader(new FileReader(name));
   2:         StreamTokenizer st = new StreamTokenizer(r);
   3:         ...
   4:         st.resetSyntax();
   5:         st.wordChars(' ', 255);
   6:         st.whitespaceChars(0, ' ');
   7:         st.commentChar('#');

View Full Code Here
   1:     counter ct = new counter(in);
   2:     StreamTokenizer s = new StreamTokenizer(new InputStreamReader(ct));
   3:         ...
   4:     s.resetSyntax();
   5:     s.wordChars(0, 255);
   6:         ...
   7:         switch (t) {
   8:         case StreamTokenizer.TT_EOF:
   9:         c = ct.getCount();

View Full Code Here
   1:   FileReader r = new FileReader(filename);
   2:   StreamTokenizer rdr = new StreamTokenizer(r);
   3:         ...
   4:   rdr.resetSyntax();
   5:   rdr.wordChars('a', 'z');
   6:         ...
   7:   int token;
   8:   while( (token = rdr.nextToken()) != StreamTokenizer.TT_EOF)
   9:   {

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:         ...
  12:     st_.resetSyntax();

View Full Code Here

slashSlashComments

public void slashSlashComments(boolean flag)
Determines whether or not the tokenizer recognizes C++-style comments. If the flag argument is true, this stream tokenizer recognizes C++-style comments. Any occurrence of two consecutive slash characters ('/') is treated as the beginning of a comment that extends to the end of the line.

If the flag argument is false, then C++-style comments are not treated specially.

Parameters:
flag - true indicates to recognize and ignore C++-style comments.
Usages and Demos :

View More Examples of slashSlashComments(boolean flag)
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:     st_.resetSyntax();
  12:         ...
  13:     st_.quoteChar('\'');
  14:     st_.slashSlashComments(true);

View Full Code Here
   1: {
   2:   System.out.println("Started test of StreamTokenizer");
   3:   
   4:         ...
   5: 
   6:       StreamTokenizer st = new StreamTokenizer(new 
   7:                                FileInputStream("./stream-tokenizer.data"));
   8:         ...
   9:                     st.slashStarComments(true);
  10:                     st.slashSlashComments(true);
  11:                   }

View Full Code Here
   1: 
   2:     final StreamTokenizer izer;
   3:     static final int DEFINE_TOKEN = 101010;
   4:         ...
   5:     int tok;
   6:     int prevTok = StreamTokenizer.TT_EOL;
   7:     String origName;
   8:         ...
   9:     JVMDIParse(Reader reader) throws IOException {
  10:         izer = new StreamTokenizer(new BufferedReader(reader));
  11:         izer.resetSyntax();
  12:         ...
  13:         izer.slashStarComments(true);
  14:         izer.slashSlashComments(true);

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new InputStreamReader
   7:                    (AglPatronType.class.getResourceAsStream
   8:         ...
   9:     st.quoteChar('\'');
  10:     st.slashSlashComments(true);
  11:     st.slashStarComments(true);
  12:         ...
  13:       {
  14:             case StreamTokenizer.TT_EOL   : r="$";               break;

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new StringReader(_text));
   7: 
   8:         ...
   9:     st.quoteChar('\'');
  10:     st.slashSlashComments(true);
  11:     st.slashStarComments(true);
  12:         ...
  13:       {
  14:             case StreamTokenizer.TT_EOL   : r="$";               break;

View Full Code Here

slashStarComments

public void slashStarComments(boolean flag)
Determines whether or not the tokenizer recognizes C-style comments. If the flag argument is true, this stream tokenizer recognizes C-style comments. All text between successive occurrences of /* and */ are discarded.

If the flag argument is false, then C-style comments are not treated specially.

Parameters:
flag - true indicates to recognize and ignore C-style comments.
Usages and Demos :

View More Examples of slashStarComments(boolean flag)
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:     st_.resetSyntax();
  12:         ...
  13:     st_.slashSlashComments(true);
  14:     st_.slashStarComments(true);

View Full Code Here
   1: {
   2:   System.out.println("Started test of StreamTokenizer");
   3:   
   4:         ...
   5: 
   6:       StreamTokenizer st = new StreamTokenizer(new 
   7:                                FileInputStream("./stream-tokenizer.data"));
   8:         ...
   9:                     st.lowerCaseMode(true);
  10:                     st.slashStarComments(true);
  11:                     st.slashSlashComments(true);

View Full Code Here
   1: 
   2:     final StreamTokenizer izer;
   3:     static final int DEFINE_TOKEN = 101010;
   4:         ...
   5:     int tok;
   6:     int prevTok = StreamTokenizer.TT_EOL;
   7:     String origName;
   8:         ...
   9:     JVMDIParse(Reader reader) throws IOException {
  10:         izer = new StreamTokenizer(new BufferedReader(reader));
  11:         izer.resetSyntax();
  12:         ...
  13:         izer.slashStarComments(true);

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new InputStreamReader
   7:                    (AglPatronType.class.getResourceAsStream
   8:         ...
   9:     st.slashSlashComments(true);
  10:     st.slashStarComments(true);
  11:     st.wordChars('a','z');
  12:         ...
  13:       {
  14:             case StreamTokenizer.TT_EOL   : r="$";               break;

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new StringReader(_text));
   7: 
   8:         ...
   9:     st.slashSlashComments(true);
  10:     st.slashStarComments(true);
  11:     st.wordChars('a','z');
  12:         ...
  13:       {
  14:             case StreamTokenizer.TT_EOL   : r="$";               break;

View Full Code Here

toString

public String toString()
Returns the string representation of the current stream token and the line number it occurs on.

The precise string returned is unspecified, although the following example can be considered typical:

Token['a'], line 10
Overrides:
toString in interface Object
Returns:
a string representation of the token
See Also:
nval, sval, ttype
Usages and Demos :

View More Examples of toString()
   1: {
   2:   System.out.println("Started test of StreamTokenizer");
   3:   
   4:         ...
   5: 
   6:       StreamTokenizer st = new StreamTokenizer(new 
   7:                                FileInputStream("./stream-tokenizer.data"));
   8:         ...
   9: 
  10:       System.out.println("No tokens read: " + st.toString());
  11:       int j = 0;
  12:         ...
  13:               case StreamTokenizer.TT_NUMBER:
  14:                 System.out.println("Read a number: " + st.toString());

View Full Code Here
   1:     }
   2:     StreamTokenizer st = new StreamTokenizer((Reader)o);
   3:     st.wordChars('.', '.');
   4:         ...
   5:       switch (token) {
   6:         case StreamTokenizer.TT_EOF:
   7:           break readTokens;
   8:         ...
   9:               throw new ParseException(
  10:                 "Parser expecting Word or String, not "+st.toString());
  11:             }
  12:         ...
  13:     VisitReplayer.replay(visitor, visTokenizer);
  14:     return visitor.toString();

View Full Code Here
   1: 
   2: import java.io.StreamTokenizer;
   3: import java.io.StringReader;
   4:         ...
   5:     PerfTask prevTask = null;
   6:     StreamTokenizer stok = new StreamTokenizer(new StringReader(algTxt));
   7:     stok.commentChar('#');
   8:         ...
   9:             if (prefix==null || prefix.length()==0) { 
  10:               throw new Exception("named report prefix problem - "+stok.toString()); 
  11:             }
  12:         ...
  13:                 case StreamTokenizer.TT_EOF:     
  14:                   throw new Exception("unexpexted EOF: - "+stok.toString());

View Full Code Here

whitespaceChars

public void whitespaceChars(int low,
                            int hi)
Specifies that all characters c in the range low <= c <= high are white space characters. White space characters serve only to separate tokens in the input stream.

Any other attribute settings for the characters in the specified range are cleared.

Parameters:
low - the low end of the range.
hi - the high end of the range.
Usages and Demos :

View More Examples of whitespaceChars(int low,int hi)
   1:     counter ct = new counter(in);
   2:     StreamTokenizer s = new StreamTokenizer(new InputStreamReader(ct));
   3:     s.resetSyntax();
   4:         ...
   5:     s.wordChars(0, 255);
   6:     s.whitespaceChars(' ', ' ');
   7:         ...
   8:     s.whitespaceChars('\n', '\n');
   9:         ...
  10:     s.whitespaceChars('\t', '\t');

View Full Code Here
   1:   FileReader r = new FileReader(filename);
   2:   StreamTokenizer rdr = new StreamTokenizer(r);
   3:   rdr.resetSyntax();
   4:         ...
   5:   rdr.wordChars('0','9');
   6:   rdr.whitespaceChars(0, '0'-1);
   7:         ...
   8:   rdr.whitespaceChars('9'+1, 'A'-1);
   9:         ...
  10:   rdr.whitespaceChars('z'+1, '\uffff');

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: import java.util.Stack;
   4:         ...
   5: public class Lecteur {
   6:   private StreamTokenizer st_;
   7:   private Stack pile_;
   8:         ...
   9:   public Lecteur(Reader _reader) {
  10:     st_= new StreamTokenizer(new BufferedReader(_reader));
  11:     st_.resetSyntax();
  12:         ...
  13:     st_.wordChars(']', ']');
  14:     st_.whitespaceChars(' ', ' ');

View Full Code Here
   1: import java.io.Reader;
   2: import java.io.StreamTokenizer;
   3: 
   4:         ...
   5: {
   6:   StreamTokenizer input = null;
   7: 
   8:         ...
   9:   {
  10:     input = new StreamTokenizer(r);
  11:     input.resetSyntax();
  12:         ...
  13:     input.quoteChar('"');
  14:     input.whitespaceChars(' ',' ');

View Full Code Here
   1:   {
   2:     private StreamTokenizer st;
   3: 
   4:         ...
   5:       {
   6:     st=new StreamTokenizer(new InputStreamReader
   7:                    (AglPatronType.class.getResourceAsStream
   8:         ...
   9:     st.wordChars(129,255);
  10:     st.whitespaceChars(' ',' ');
  11:         ...
  12:     st.whitespaceChars('\t','\t');

View Full Code Here

wordChars

public void wordChars(int low,
                      int hi)
Specifies that all characters c in the range low <= c <= high are word constituents. A word token consists of a word constituent followed by zero or more word constituents or number constituents.
Parameters:
low - the low end of the range.
hi - the high end of the range.
Usages and Demos :

View More Examples of wordChars(int low,int hi)
   1:     Vector results = new Vector();
   2:     StreamTokenizer toks = new StreamTokenizer(chars);
   3:     String line, id, name, residues;
   4:         ...
   5:     toks.ordinaryChars('0', '9');
   6:     toks.wordChars('!', '~');
   7:     toks.eolIsSignificant(true);
   8:         ...
   9:     int tok;
  10:     while (StreamTokenizer.TT_EOF != (tok = toks.nextToken())) {
  11:       if (StreamTokenizer.TT_WORD == tok) {

View Full Code Here
   1: 
   2:     private StreamTokenizer fTokenizer;
   3:     private List            fMap;
   4:         ...
   5:         Reader r = new BufferedReader(new InputStreamReader(stream));
   6:         fTokenizer = new StreamTokenizer(r);
   7:         ...
   8:         fTokenizer.wordChars('$', '$');
   9:         fMap = CollectionsFactory.current().createList();
  10:         ...
  11:         int token = fTokenizer.nextToken();
  12:         if (token == StreamTokenizer.TT_WORD || token == '"') {

View Full Code Here
   1:     String infileName, outfileName;
   2:     StreamTokenizer inp;
   3: 
   4:         ...
   5:     if (argv.length == 0)
   6:       inp = new StreamTokenizer(System.in);
   7:     else
   8:         ...
   9:       inp =
  10:         new StreamTokenizer
  11:         (new BufferedInputStream
  12:         ...
  13:     inp.resetSyntax();
  14:     inp.wordChars('a', 'z');

View Full Code Here
   1:     public Precondition(String ifHeader) throws WebDAVException {
   2:         StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(ifHeader));
   3:         ...
   4:         tokenizer.wordChars('!', '/');
   5:         ...
   6:         tokenizer.wordChars(':', '@');
   7:         tokenizer.ordinaryChar('(');
   8:         ...
   9:             }
  10:             if (token != StreamTokenizer.TT_EOF)

View Full Code Here
   1: import java.io.InputStream;
   2: import java.io.StreamTokenizer;
   3: import java.io.IOException;
   4:         ...
   5:     String fname;
   6:     StreamTokenizer in;
   7:     ClassFileFinder finder;
   8:         ...
   9:     fname = name;
  10:     in = new StreamTokenizer(
  11:         new java.io.BufferedInputStream(
  12:         ...
  13:     in.whitespaceChars( 0, 0x20 );
  14:     in.wordChars( '!', '~' );

View Full Code Here