Class NumberParserContext

java.lang.Object
blue.endless.jankson.impl.NumberParserContext
All Implemented Interfaces:
ParserContext<JsonPrimitive>

public class NumberParserContext extends Object implements ParserContext<JsonPrimitive>
  • Constructor Summary

    Constructors
    Constructor
    Description
    NumberParserContext(int firstCodePoint)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    consume(int codePoint, Jankson loader)
    Consume one codepoint from the stream, and either use it to continue composing the result or to discover that the result is complete and processing should stop.
    void
    eof()
    Notifies this context that the file ended abruptly while in this context and before isComplete returned true.
    Gets the result of parsing.
    boolean
    Returns true if the parser has assembled a complete result.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NumberParserContext

      public NumberParserContext(int firstCodePoint)
  • Method Details

    • consume

      public boolean consume(int codePoint, Jankson loader) throws SyntaxError
      Description copied from interface: ParserContext
      Consume one codepoint from the stream, and either use it to continue composing the result or to discover that the result is complete and processing should stop. Throws a SyntaxError if unexpected or nonsense characters are encountered.
      Specified by:
      consume in interface ParserContext<JsonPrimitive>
      Throws:
      SyntaxError
    • eof

      public void eof() throws SyntaxError
      Description copied from interface: ParserContext
      Notifies this context that the file ended abruptly while in this context and before isComplete returned true. In some contexts, like a single-line comment, this is fine. In most contexts, this should throw a descriptive error.
      Specified by:
      eof in interface ParserContext<JsonPrimitive>
      Throws:
      SyntaxError
    • isComplete

      public boolean isComplete()
      Description copied from interface: ParserContext
      Returns true if the parser has assembled a complete result. After true is returned, no more code points will be offered to consume, and getResult will soon be called to retrieve the result.
      Specified by:
      isComplete in interface ParserContext<JsonPrimitive>
    • getResult

      public JsonPrimitive getResult() throws SyntaxError
      Description copied from interface: ParserContext
      Gets the result of parsing. Will be called only after isComplete reports true and processing of input has ceased.
      Specified by:
      getResult in interface ParserContext<JsonPrimitive>
      Throws:
      SyntaxError