Package ej.json

Class JSONReader


  • public class JSONReader
    extends Object
    A JSONReader takes a source InputStream and extracts characters and tokens from it.
    • Field Detail

      • NULL

        public static final Object NULL
        It is sometimes more convenient and less ambiguous to have a NULL object than to use Java's null value. NULL.equals(null) returns true. NULL.toString() returns "null".
    • Constructor Detail

      • JSONReader

        public JSONReader​(InputStream is)
        Construct a JSONReader from an InputStream.
        Parameters:
        is - the InputStream.
    • Method Detail

      • peek

        public char peek()
                  throws JSONException
        Get the first character of the next token.
        Returns:
        the first character or 0 on EOF.
        Throws:
        JSONException - on I/O error
      • nextValue

        public Object nextValue()
                         throws JSONException
        Get the next value. The value can be a Boolean, Double, Integer, Long, or String, or the JSONReader.Null object.
        Returns:
        An object or null if the beginning of array or a map is reached.
        Throws:
        JSONException - If syntax error.