java.lang.Object
provided.tokenFW.tokenizer.StringTokenizer
- All Implemented Interfaces:
IStringTokenizer
- Direct Known Subclasses:
ABCTokenizer
Special tokenizer that converts a stream of various types of tokens from StreamTokenizer and converts them into a stream of strings.
- Author:
- swong
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ReaderReader to use.protected StreamTokenizerStreamTokenizer to use.private ILoggerlogger to useStack used for token push-back -
Constructor Summary
ConstructorsConstructorDescriptionStringTokenizer(String inputFileName)Initialize _st to read from a input Reader file with the given input file name. -
Method Summary
Modifier and TypeMethodDescriptionGet the next token in the streamprivate StringReturns the next string in the stream.voidputStringBack(String str)Puts the given string back into the stream.
-
Field Details
-
logger
logger to use -
stack
Stack used for token push-back -
_st
StreamTokenizer to use. -
_fileReader
Reader to use.
-
-
Constructor Details
-
StringTokenizer
Initialize _st to read from a input Reader file with the given input file name.- Parameters:
inputFileName- the name of the input text file- Throws:
FileNotFoundException- When the input file could not be opened
-
-
Method Details
-
getNextStringToken
Get the next token in the stream- Specified by:
getNextStringTokenin interfaceIStringTokenizer- Returns:
- the next token.
-
putStringBack
Puts the given string back into the stream. If nothing else is done, this would be the next token returned by getNextToken- Specified by:
putStringBackin interfaceIStringTokenizer- Parameters:
str- the token to push back into the tokenizer
-
makeNextStringToken
Returns the next string in the stream. Returns LF ("\n") at end of line. Returns null for EOF or error- Returns:
- A string token or null if EOF
-