|
MjSip Stack v1.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.zoolu.tools.Parser
Class Parser allows the parsing of String objects.
An object Parser is costructed from a String object and provides various methods for parsing the String in a stream oriented manner.
The class Parser also collects different static methods for parsing non-pre-associated strings.
Parser uses the following definitions:
string = any string of chars included between ' ' and '~'
word = any string of chars without separators
separators = a vector of chars; e.g. ( ) < > @ , ; : \ " / | [ ] ? = { } HT SP
alpha = a-z, A-Z
digit = 0-9
integer = any digit word parsed byInteger.parseInt(String)
| Field Summary | |
static char[] |
CRLF
Characters CR and LF. |
protected int |
index
The the current pointer to the next char within the string. |
static char[] |
SPACE
The same as WSP (for legacy) |
protected java.lang.String |
str
The string that is being parsed. |
static char[] |
WSP
Characters space (SP) and tab (HT). |
static char[] |
WSPCRLF
Characters white-space, tab, CR, and LF. |
| Constructor Summary | |
Parser(java.lang.String s)
Creates the Parser from the String s and point to the beginning of the string. |
|
Parser(java.lang.StringBuffer sb)
Creates the Parser from the StringBuffer sb and point to the beginning of the string. |
|
Parser(java.lang.StringBuffer sb,
int i)
Creates the Parser from the StringBuffer sb and point to the position i. |
|
Parser(java.lang.String s,
int i)
Creates the Parser from the String s and point to the position i. |
|
| Method Summary | |
char |
charAt(int n)
Gets the char at distance n WITHOUT going over |
static int |
compareIgnoreCase(char c1,
char c2)
Compares two chars ignoring case |
char |
getChar()
Gets the next char and go over |
double |
getDouble()
Gets a double and point to the next char |
int |
getInt()
Gets an integer and point to the next char |
java.lang.String |
getLine()
Gets all chars until the end of the line (or the end of the parser) and go to the next line. |
int |
getPos()
Gets the current index position. |
java.lang.String |
getRemainingString()
Gets the rest of the (unparsed) string. |
java.lang.String |
getString()
Gets a continuous string of char and go to the next char |
java.lang.String |
getString(int len)
Gets a string of length len and move over. |
java.lang.String[] |
getStringArray()
Gets all string |
java.lang.String |
getStringUnquoted()
Gets the first quatable string, that is a normal string, or text in quotes. |
java.util.Vector |
getStringVector()
Gets all strings |
java.lang.String |
getWholeString()
Gets the entire string |
java.lang.String |
getWord(char[] separators)
Gets a string of chars separated by any of chars of separators |
java.lang.String[] |
getWordArray(char[] separators)
Gets all string of chars separated by any char belonging to separators |
java.lang.String |
getWordSkippingQuoted(char[] separators)
Gets a string of chars separated by any of chars in separators , skipping any separator inside possible quoted texts. |
java.util.Vector |
getWordVector(char[] separators)
Gets all string of chars separated by any char belonging to separators |
Parser |
goTo(char c)
Goes to the next occurence of char c |
Parser |
goTo(char[] cc)
Goes to the next occurence of any char of array cc |
Parser |
goTo(java.lang.String s)
Goes to the next occurence of String s |
Parser |
goTo(java.lang.String[] ss)
Goes to the next occurence of any string of array ss |
Parser |
goToIgnoreCase(java.lang.String s)
Goes to the next occurence of String s |
Parser |
goToIgnoreCase(java.lang.String[] ss)
Goes to the next occurence of any string of array ss |
Parser |
goToNextLine()
Goes to the begin of the new line |
Parser |
goToSkippingQuoted(char c)
Points to the next occurence of char c not in quotes. |
boolean |
hasMore()
Whether there are more chars to parse. |
int |
indexOf(char c)
Gets the index of the first occurence of char c |
int |
indexOf(char[] cc)
Gets the index of the first occurence of any char of array cc within string str starting form begin; return -1 if no occurence is found |
int |
indexOf(java.lang.String s)
Gets the index of the first occurence of String s |
int |
indexOf(java.lang.String[] ss)
Gets the index of the first occurence of any string of array ss within string str; return -1 if no occurence is found. |
int |
indexOfIgnoreCase(java.lang.String s)
Gets the index of the first occurence of String s ignoring case. |
int |
indexOfIgnoreCase(java.lang.String[] ss)
Gets the index of the first occurence of any string of array ss ignoring case. |
int |
indexOfNextLine()
Gets the begin of next line |
static boolean |
isAlpha(char c)
Alpha |
static boolean |
isAlphanum(char c)
Alphanum |
static boolean |
isAnyOf(char[] ca,
char ch)
True if char ch is any char of array ca |
static boolean |
isChar(char c)
Valid ASCII char |
static boolean |
isCR(char c)
CR |
static boolean |
isCRLF(char c)
CR or LF |
static boolean |
isDigit(char c)
Digit |
static boolean |
isHT(char c)
HT |
static boolean |
isLF(char c)
LF |
static boolean |
isLowAlpha(char c)
Low alpha |
static boolean |
isSP(char c)
SP |
static boolean |
isUpAlpha(char c)
Up alpha |
static boolean |
isWSP(char c)
SP or tab |
static boolean |
isWSPCRLF(char c)
SP, tab, CR, or LF |
int |
length()
Length of unparsed string. |
char |
nextChar()
Gets the next char WITHOUT going over |
Parser |
setPos(int i)
Goes to position i |
Parser |
skipChar()
Skips one char |
Parser |
skipChars(char[] cc)
Skips any selected chars |
Parser |
skipCRLF()
Skips return lines |
Parser |
skipN(int n)
Skips N chars |
Parser |
skipString()
Skips a continuous string of char and go to the next "blank" char |
Parser |
skipWSP()
Skips all spaces |
Parser |
skipWSPCRLF()
Skips white spaces or return lines |
boolean |
startsWith(java.lang.String s)
Whether next chars equal to a specific String s. |
boolean |
startsWith(java.lang.String[] ss)
Whether next chars equal to any string of array ss. |
boolean |
startsWithIgnoreCase(java.lang.String s)
Whether next chars equal to a specific String s ignoring case. |
boolean |
startsWithIgnoreCase(java.lang.String[] ss)
Whether next chars equal to any string of array ss ignoring case. |
Parser |
subParser(int len)
Returns a new the Parser of len chars statirng from the current position. |
java.lang.String |
toString()
convert the rest of the unparsed chars into a string |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.lang.String str
protected int index
public static char[] WSP
public static char[] SPACE
public static char[] CRLF
public static char[] WSPCRLF
| Constructor Detail |
public Parser(java.lang.String s)
public Parser(java.lang.String s,
int i)
public Parser(java.lang.StringBuffer sb)
public Parser(java.lang.StringBuffer sb,
int i)
| Method Detail |
public int getPos()
public java.lang.String getWholeString()
public java.lang.String getRemainingString()
public Parser subParser(int len)
public int length()
public boolean hasMore()
public char getChar()
public char charAt(int n)
public char nextChar()
public Parser setPos(int i)
public Parser goTo(char c)
public Parser goTo(char[] cc)
public Parser goTo(java.lang.String s)
public Parser goTo(java.lang.String[] ss)
public Parser goToIgnoreCase(java.lang.String s)
public Parser goToIgnoreCase(java.lang.String[] ss)
public Parser goToNextLine()
public static boolean isAnyOf(char[] ca,
char ch)
public static boolean isUpAlpha(char c)
public static boolean isLowAlpha(char c)
public static boolean isAlpha(char c)
public static boolean isAlphanum(char c)
public static boolean isDigit(char c)
public static boolean isChar(char c)
public static boolean isCR(char c)
public static boolean isLF(char c)
public static boolean isCRLF(char c)
public static boolean isHT(char c)
public static boolean isSP(char c)
public static boolean isWSP(char c)
public static boolean isWSPCRLF(char c)
public static int compareIgnoreCase(char c1,
char c2)
public int indexOf(char c)
public int indexOf(char[] cc)
public int indexOf(java.lang.String s)
public int indexOf(java.lang.String[] ss)
public int indexOfIgnoreCase(java.lang.String s)
public int indexOfIgnoreCase(java.lang.String[] ss)
public int indexOfNextLine()
public boolean startsWith(java.lang.String s)
public boolean startsWith(java.lang.String[] ss)
public boolean startsWithIgnoreCase(java.lang.String s)
public boolean startsWithIgnoreCase(java.lang.String[] ss)
public Parser skipChar()
public Parser skipN(int n)
public Parser skipWSP()
public Parser skipCRLF()
public Parser skipWSPCRLF()
public Parser skipChars(char[] cc)
public Parser skipString()
public java.lang.String getString()
public java.lang.String getString(int len)
public java.lang.String getWord(char[] separators)
public int getInt()
public double getDouble()
public java.lang.String getLine()
public java.util.Vector getWordVector(char[] separators)
public java.lang.String[] getWordArray(char[] separators)
public java.util.Vector getStringVector()
public java.lang.String[] getStringArray()
public java.lang.String getWordSkippingQuoted(char[] separators)
public java.lang.String getStringUnquoted()
public Parser goToSkippingQuoted(char c)
public java.lang.String toString()
toString in class java.lang.Object
|
MjSip Stack v1.6 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||