Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » util » [javadoc | source]
org.apache.catalina.util
public final class: StringParser [javadoc | source]
java.lang.Object
   org.apache.catalina.util.StringParser
Utility class for string parsing that is higher performance than StringParser for simple delimited text cases. Parsing is performed by setting the string, and then using the findXxxx() and skipXxxx() families of methods to remember significant offsets. To retrieve the parsed substrings, call the extract() method with the appropriate saved offset values.
Constructor:
 public StringParser() 
 public StringParser(String string) 
    Construct a string parser that is initialized to parse the specified string.
    Parameters:
    string - The string to be parsed
Method from org.apache.catalina.util.StringParser Summary:
advance,   extract,   extract,   findChar,   findText,   findWhite,   getIndex,   getLength,   getString,   isWhite,   reset,   setString,   skipChar,   skipText,   skipWhite
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.catalina.util.StringParser Detail:
 public  void advance() 
    Advance the current parsing position by one, if we are not already past the end of the string.
 public String extract(int start) 
    Extract and return a substring that starts at the specified position, and extends to the end of the string being parsed. If this is not possible, a zero-length string is returned.
 public String extract(int start,
    int end) 
    Extract and return a substring that starts at the specified position, and ends at the character before the specified position. If this is not possible, a zero-length string is returned.
 public int findChar(char ch) 
    Return the index of the next occurrence of the specified character, or the index of the character after the last position of the string if no more occurrences of this character are found. The current parsing position is updated to the returned value.
 public int findText() 
    Return the index of the next occurrence of a non-whitespace character, or the index of the character after the last position of the string if no more non-whitespace characters are found. The current parsing position is updated to the returned value.
 public int findWhite() 
    Return the index of the next occurrence of a whitespace character, or the index of the character after the last position of the string if no more whitespace characters are found. The current parsing position is updated to the returned value.
 public int getIndex() 
    Return the zero-relative index of our current parsing position within the string being parsed.
 public int getLength() 
    Return the length of the string we are parsing.
 public String getString() 
    Return the String we are currently parsing.
 protected boolean isWhite(char ch) 
    Is the specified character considered to be whitespace?
 public  void reset() 
    Reset the current state of the parser to the beginning of the current string being parsed.
 public  void setString(String string) 
    Set the String we are currently parsing. The parser state is also reset to begin at the start of this string.
 public int skipChar(char ch) 
    Advance the current parsing position while it is pointing at the specified character, or until it moves past the end of the string. Return the final value.
 public int skipText() 
    Advance the current parsing position while it is pointing at a non-whitespace character, or until it moves past the end of the string. Return the final value.
 public int skipWhite() 
    Advance the current parsing position while it is pointing at a whitespace character, or until it moves past the end of the string. Return the final value.