Class JsonLexer


  • public class JsonLexer
    extends java.lang.Object
    A simple JSON lexer
    Author:
    Michel Kramer
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  JsonLexer.Type
      Token types
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonLexer​(java.io.Reader r)
      Creates a new lexer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      JsonLexer.Type readNextToken()
      Reads the next token from the stream
      java.lang.Number readNumber()
      Reads a number from the stream
      java.lang.String readString()
      Reads a string from the stream
      • Methods inherited from class java.lang.Object

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

      • JsonLexer

        public JsonLexer​(java.io.Reader r)
        Creates a new lexer
        Parameters:
        r - the reader that provides the JSON to scan
    • Method Detail

      • readNextToken

        public JsonLexer.Type readNextToken()
                                     throws java.io.IOException
        Reads the next token from the stream
        Returns:
        the token
        Throws:
        java.io.IOException - if the stream could not be read
      • readString

        public java.lang.String readString()
                                    throws java.io.IOException
        Reads a string from the stream
        Returns:
        the string
        Throws:
        java.io.IOException - if the stream could not be read
      • readNumber

        public java.lang.Number readNumber()
                                    throws java.io.IOException
        Reads a number from the stream
        Returns:
        the number
        Throws:
        java.io.IOException - if the stream could not be read