ch.sahits.test
Class TextFileTokenizer

java.lang.Object
  extended by java.util.StringTokenizer
      extended by ch.sahits.test.TextFileTokenizer
All Implemented Interfaces:
java.util.Enumeration<java.lang.Object>

public class TextFileTokenizer
extends java.util.StringTokenizer

This class is a tokenizer for a text file. Internaly the tokenizer uses a StringTokenizer. Line endings '\n' and '\r' are converted into spaces.

Author:
Andi Hotz, Sahits GmbH

Constructor Summary
TextFileTokenizer(java.io.InputStream in, java.lang.String delim)
          Create a tokenizer based on an input stream.
TextFileTokenizer(java.lang.String fileName)
          Initialize the tokenizer with delimiters
TextFileTokenizer(java.lang.String fileName, java.lang.String delim)
          Initialize the tokenizer with delimiters
TextFileTokenizer(java.lang.String fileName, java.lang.String delim, boolean returnDelims)
          Initialize the tokenizer with delimiters and delimiter flag
 
Method Summary
 
Methods inherited from class java.util.StringTokenizer
countTokens, hasMoreElements, hasMoreTokens, nextElement, nextToken, nextToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFileTokenizer

public TextFileTokenizer(java.lang.String fileName,
                         java.lang.String delim,
                         boolean returnDelims)
                  throws java.io.IOException
Initialize the tokenizer with delimiters and delimiter flag

Parameters:
fileName - fully qualified path to the file to be read
delim -
returnDelims -
Throws:
java.io.FileNotFoundException - file path is invalid
java.io.IOException - Error while reading from the file

TextFileTokenizer

public TextFileTokenizer(java.lang.String fileName,
                         java.lang.String delim)
                  throws java.io.IOException
Initialize the tokenizer with delimiters

Parameters:
fileName - fully qualified path to the file to be read
delim -
Throws:
java.io.FileNotFoundException - file path is invalid
java.io.IOException - Error while reading from the file

TextFileTokenizer

public TextFileTokenizer(java.lang.String fileName)
                  throws java.io.IOException
Initialize the tokenizer with delimiters

Parameters:
fileName - fully qualified path to the file to be read
Throws:
java.io.FileNotFoundException - file path is invalid
java.io.IOException - Error while reading from the file

TextFileTokenizer

public TextFileTokenizer(java.io.InputStream in,
                         java.lang.String delim)
                  throws java.io.IOException
Create a tokenizer based on an input stream. The stream is not closed after it is passed on

Parameters:
in - Input Stream
delim -
Throws:
java.io.IOException - Error while reading from the stream