Class StringParser


  • public final class StringParser
    extends java.lang.Object
    Simple parser for parsing string values into more complex objects.
    • Field Detail

      • startOffset

        protected int startOffset
      • endOffset

        protected int endOffset
      • nextStartOffset

        protected int nextStartOffset
    • Constructor Detail

    • Method Detail

      • isQuoted

        public boolean isQuoted()
        Was the current token text quoted.
      • nextToken

        public java.lang.String nextToken()
        The text for the next unconsumed token.
      • isNextQuoted

        public boolean isNextQuoted()
      • getParameter

        public java.lang.String getParameter​(java.lang.String key,
                                             java.lang.String defaultValue)
        Get the first value for a CGI Parameter.
      • getParameter

        public double getParameter​(java.lang.String key,
                                   double defaultValue)
        Get the first value for a CGI Parameter as a double.
      • getParameter

        public int getParameter​(java.lang.String key,
                                int defaultValue)
        Get the first value for a CGI Parameter as an int.
      • eos

        public boolean eos()
        Returns true if end of stream has been reached.
      • hasNext

        public boolean hasNext()
        Returns true if there another token is available.
      • expectParameterName

        public boolean expectParameterName()
      • expectSingleQuotedString

        public boolean expectSingleQuotedString()
      • expectNumber

        public boolean expectNumber()
      • expectInteger

        public boolean expectInteger()
      • expectDate

        public boolean expectDate()
      • expectBinary

        public boolean expectBinary()
      • expectVariable

        public boolean expectVariable()
      • expectQuotedString

        public boolean expectQuotedString()
        Expect a quoted string.
      • expectKeyword

        public boolean expectKeyword()
        Expect an unquoted string.
      • expectKeyword

        public boolean expectKeyword​(java.lang.String keyword)
      • requireKeyword

        public StringParser requireKeyword​(java.lang.String keyword)
      • getStartOffset

        public int getStartOffset()
      • getEndOffset

        public int getEndOffset()
      • getNextStartOffset

        public int getNextStartOffset()
      • getString

        public java.lang.String getString()
        Get the current token's text as a String.
      • getVariableName

        public java.lang.String getVariableName()
        Get the variable name for a VAR token.
      • getBinary

        public byte[] getBinary()
        Get the current token's text as a byte[].
      • getFloat

        public float getFloat()
        Get the current token as a float.
      • getDouble

        public double getDouble()
        Get the current token as a double.
      • getInteger

        public int getInteger()
        Get the current token as an integer.
      • getLong

        public long getLong()
        Get the current token as a long integer.
      • getDecimal

        public java.math.BigDecimal getDecimal()
        Get the current token as a BigDecimal.
      • getDate

        public java.util.Date getDate​(java.util.TimeZone timeZone)
        Get the current token as a Date.
      • readBinary

        public byte[] readBinary()
      • readString

        public java.lang.String readString()
      • readKeyword

        public java.lang.String readKeyword()
      • readFloat

        public float readFloat()
      • readDouble

        public double readDouble()
      • readPoint

        public Point readPoint()
      • expectDecimal

        public java.math.BigDecimal expectDecimal()
      • readDecimal

        public java.math.BigDecimal readDecimal()
      • readInteger

        public int readInteger()
      • readLong

        public long readLong()
      • readUnsigned

        public int readUnsigned()
      • readBoolean

        public boolean readBoolean()
      • readIsoDate

        public java.util.Date readIsoDate​(java.util.TimeZone timeZone)
      • readDate

        public java.util.Date readDate​(java.util.TimeZone timeZone)
      • quote

        public static java.lang.String quote​(java.lang.String text)
        Conditionally wrap text in double quotes if it contains reserved characters or is an empty string.
      • encodeVariableName

        public static void encodeVariableName​(java.lang.StringBuilder buffer,
                                              java.lang.String name)
      • valueOf

        public static StringParser valueOf​(java.lang.String value)