ANTS v2.0 API

ants.util
Class LineListTokenizer

java.lang.Object
  |
  +--java.io.StreamTokenizer
        |
        +--ants.util.LineListTokenizer

public class LineListTokenizer
extends java.io.StreamTokenizer

File reading utility. Returns each useful line of text as an array of strings, one string per "word." Comments are ignored and quoted strings are handled (the quotes are stripped off and the quoted string is returned as a single word).

Max of 256 words per line (see MAXLIST).

Author:
David Wetherall, Utah Janos Team

Fields inherited from class java.io.StreamTokenizer
nval, sval, TT_EOF, TT_EOL, TT_NUMBER, TT_WORD, ttype
 
Constructor Summary
LineListTokenizer(java.io.Reader input)
          Create a new LineListTokenizer from the given readable Stream.
LineListTokenizer(java.lang.String file)
          Create a new LineListTokenizer for the given file.
 
Method Summary
 java.lang.String[] list()
          Parse the next non-empty line into an array of strings.
 
Methods inherited from class java.io.StreamTokenizer
commentChar, eolIsSignificant, lineno, lowerCaseMode, nextToken, ordinaryChar, ordinaryChars, parseNumbers, pushBack, quoteChar, resetSyntax, slashSlashComments, slashStarComments, toString, whitespaceChars, wordChars
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineListTokenizer

public LineListTokenizer(java.lang.String file)
                  throws java.io.FileNotFoundException
Create a new LineListTokenizer for the given file.
Parameters:
file - the file to use as input.
Throws:
java.io.FileNotFoundException - if the given file cannot be opened for reading.

LineListTokenizer

public LineListTokenizer(java.io.Reader input)
Create a new LineListTokenizer from the given readable Stream.
Parameters:
input - the Reader to stream input from.
Method Detail

list

public java.lang.String[] list()
                        throws LineListException
Parse the next non-empty line into an array of strings. Result is null when EOF, and otherwise has at least one element.

XXX rename to nextLine()

Returns:
an array of tokens from the line.

ANTS v2.0 API

This documentation is Copyright (C) 1998-2001 The University of Utah and the University of Washington. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for ANTS v2.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/