Methods Summary |
---|
public java.lang.String | getPostToken()
return suppressDelims || includeDelims ? "" : intraString;
|
public java.lang.String | getToken(java.io.Reader in)find and return the next token
int ch = -1;
if (pushed != -2) {
ch = pushed;
pushed = -2;
} else {
ch = in.read();
}
if (ch == -1) {
return null;
}
boolean inToken = true;
intraString = "";
StringBuffer word = new StringBuffer();
StringBuffer padding = new StringBuffer();
while (ch != -1) {
char c = (char) ch;
boolean isDelim = isDelim(c);
if (inToken) {
if (isDelim) {
if (delimsAreTokens) {
if (word.length() == 0) {
word.append(c);
} else {
pushed = ch;
}
break;
}
padding.append(c);
inToken = false;
} else {
word.append(c);
}
} else {
if (isDelim) {
padding.append(c);
} else {
pushed = ch;
break;
}
}
ch = in.read();
}
intraString = padding.toString();
if (includeDelims) {
word.append(intraString);
}
return word.toString();
|
private boolean | isDelim(char ch)
if (delims == null) {
return Character.isWhitespace(ch);
}
for (int i = 0; i < delims.length; ++i) {
if (delims[i] == ch) {
return true;
}
}
return false;
|
public void | setDelims(java.lang.String delims)attribute delims - the delimiter characters
this.delims = StringUtils.resolveBackSlash(delims).toCharArray();
|
public void | setDelimsAreTokens(boolean delimsAreTokens)attribute delimsaretokens - treat delimiters as
separate tokens.
this.delimsAreTokens = delimsAreTokens;
|
public void | setIncludeDelims(boolean includeDelims)attribute includedelims - treat delimiters as part
of the token.
default - false
this.includeDelims = includeDelims;
|
public void | setSuppressDelims(boolean suppressDelims)attribute suppressdelims - suppress delimiters.
default - false
this.suppressDelims = suppressDelims;
|