public final class StringParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
StringParser.TokenType
Type for a token.
|
Modifier and Type | Field and Description |
---|---|
protected int |
endOffset |
protected int |
nextStartOffset |
protected int |
startOffset |
Modifier | Constructor and Description |
---|---|
protected |
StringParser(String source,
long flags,
CgiRequest cgi,
MessageMetadata metas) |
Modifier and Type | Method and Description |
---|---|
boolean |
eos()
Returns
true if end of stream has been reached. |
boolean |
expect(StringParser.TokenType type) |
boolean |
expect(StringParser.TokenType a,
StringParser.TokenType b) |
boolean |
expectBinary() |
boolean |
expectDate() |
BigDecimal |
expectDecimal() |
boolean |
expectKeyword()
Expect an unquoted string.
|
boolean |
expectKeyword(String keyword) |
boolean |
expectNumber() |
boolean |
expectParameterName() |
boolean |
expectQuotedString()
Expect a quoted string.
|
boolean |
expectSingleQuotedString() |
byte[] |
getBinary()
Get the current token's text as a
byte[] . |
Date |
getDate(TimeZone timeZone)
Get the current token as a Date.
|
BigDecimal |
getDecimal()
Get the current token as a
BigDecimal . |
double |
getDouble()
Get the current token as a double.
|
int |
getEndOffset() |
float |
getFloat()
Get the current token as a float.
|
int |
getInteger()
Get the current token as an integer.
|
long |
getLong()
Get the current token as a long integer.
|
int |
getNextStartOffset() |
double |
getParameter(String key,
double defaultValue)
Get the first value for a CGI Parameter as a
double . |
int |
getParameter(String key,
int defaultValue)
Get the first value for a CGI Parameter as an
int . |
String |
getParameter(String key,
String defaultValue)
Get the first value for a CGI Parameter.
|
int |
getStartOffset() |
String |
getString()
Get the current token's text as a String.
|
boolean |
hasNext()
Returns
true if there another token is available. |
boolean |
isNextQuoted() |
boolean |
isQuoted()
Was the current token text quoted.
|
String |
nextToken()
The text for the next unconsumed token.
|
StringParser.TokenType |
nextType() |
static String |
quote(String text)
Conditionally wrap
text in double quotes if it contains reserved characters or is an empty string. |
byte[] |
readBinary() |
boolean |
readBoolean() |
Date |
readDate(TimeZone timeZone) |
BigDecimal |
readDecimal() |
double |
readDouble() |
FieldExpression |
readFieldExpression() |
float |
readFloat() |
int |
readInteger() |
Date |
readIsoDate(TimeZone timeZone) |
String |
readKeyword() |
long |
readLong() |
Point |
readPoint() |
String |
readString() |
int |
readUnsigned() |
StringParser |
require(StringParser.TokenType type) |
StringParser |
require(StringParser.TokenType a,
StringParser.TokenType b) |
StringParser |
requireEx(StringParser.TokenType type) |
StringParser |
requireKeyword(String keyword) |
static StringParser |
valueOf(String value) |
static StringParser |
valueOf(String value,
CgiRequest cgi) |
static StringParser |
valueOf(String value,
MessageMetadata metas) |
protected int startOffset
protected int endOffset
protected int nextStartOffset
protected StringParser(String source, long flags, CgiRequest cgi, MessageMetadata metas)
public boolean isQuoted()
public String nextToken()
public StringParser.TokenType nextType()
public boolean isNextQuoted()
public String getParameter(String key, String defaultValue)
public double getParameter(String key, double defaultValue)
double
.public int getParameter(String key, int defaultValue)
int
.public boolean eos()
true
if end of stream has been reached.public boolean hasNext()
true
if there another token is available.public boolean expect(StringParser.TokenType type)
public boolean expect(StringParser.TokenType a, StringParser.TokenType b)
public boolean expectParameterName()
public boolean expectSingleQuotedString()
public boolean expectNumber()
public boolean expectDate()
public boolean expectBinary()
public boolean expectQuotedString()
public boolean expectKeyword()
public boolean expectKeyword(String keyword)
public StringParser require(StringParser.TokenType a, StringParser.TokenType b)
public StringParser require(StringParser.TokenType type)
public StringParser requireEx(StringParser.TokenType type) throws ParseException
ParseException
public StringParser requireKeyword(String keyword)
public int getStartOffset()
public int getEndOffset()
public int getNextStartOffset()
public String getString()
public byte[] getBinary()
byte[]
.public float getFloat()
public double getDouble()
public int getInteger()
public long getLong()
public BigDecimal getDecimal()
BigDecimal
.public FieldExpression readFieldExpression()
public byte[] readBinary()
public String readString()
public String readKeyword()
public float readFloat()
public double readDouble()
public Point readPoint()
public BigDecimal expectDecimal()
public BigDecimal readDecimal()
public int readInteger()
public long readLong()
public int readUnsigned()
public boolean readBoolean()
public static String quote(String text)
text
in double quotes if it contains reserved characters or is an empty string.public static StringParser valueOf(String value)
public static StringParser valueOf(String value, MessageMetadata metas)
public static StringParser valueOf(String value, CgiRequest cgi)
Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.