Class COM.ibm.jaws.motk.Tokenizer
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.ibm.jaws.motk.Tokenizer

java.lang.Object
   |
   +----COM.ibm.jaws.motk.Tokenizer

public class Tokenizer
extends Object
Parses a character stream into tokens based on a set of specified delimiter characters. Delimiter characters proceeded by the specified escape character will be used to end tokens.

Variable Index

 o d

Constructor Index

 o Tokenizer(CharProducer, String, char)
Creates a new Tokenizer.

Method Index

 o read(StringBuffer, boolean)
Appends characters from the input CharProducer to the indicated StringBuffer until a delimiter character or EOF is encountered.
 o trim(StringBuffer, int, char)
Strips leading and trailing white space from the indicated StringBuffer starting with the indicated position.

Variables

 o d
  public static Debug d

Constructors

 o Tokenizer
  public Tokenizer(CharProducer in,
                   String delimiters,
                   char escape)
Creates a new Tokenizer.
Parameters:
in - the input character stream
delimiters - the characters used to end tokens
escape - the character used to escape delimiters

Methods

 o read
  public int read(StringBuffer buf,
                  boolean trim) throws IOException
Appends characters from the input CharProducer to the indicated StringBuffer until a delimiter character or EOF is encountered. The delimiter character or EOF will be returned. Delimiter characters proceeded may be escaped. The escape sequences are not removed.
Parameters:
buf - a StringBuffer that recieves the token. appended to it.
trim - if true the leading and trailing whitespace will be removed.
Returns:
the delimiter character or EOF (-1)
 o trim
  public static void trim(StringBuffer buf,
                          int startPos,
                          char escape)
Strips leading and trailing white space from the indicated StringBuffer starting with the indicated position.
Parameters:
buf - the StringBuffer to be trimed, it will be modified.
startPos - the position to start triming at. No data prior to startPos will be modified.

All Packages  Class Hierarchy  This Package  Previous  Next  Index