Klasse JsonParser

java.lang.Object
com.restfb.json.JsonParser

public class JsonParser extends Object
A streaming parser for JSON text. The parser reports all events to a given handler.
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    JsonParser(JsonHandler<?,?> handler)
    Creates a new JsonParser with the given handler.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    void
    parse(Reader reader)
    Reads the entire input from the given reader and parses it as JSON.
    void
    parse(Reader reader, int buffersize)
    Reads the entire input from the given reader and parses it as JSON.
    void
    parse(String string)
    Parses the given input string.

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Konstruktordetails

    • JsonParser

      public JsonParser(JsonHandler<?,?> handler)
      Creates a new JsonParser with the given handler. The parser will report all parser events to this handler.
      Parameter:
      handler - the handler to process parser events
  • Methodendetails

    • parse

      public void parse(String string)
      Parses the given input string. The input must contain a valid JSON value, optionally padded with whitespace.
      Parameter:
      string - the input string, must be valid JSON
      Löst aus:
      ParseException - if the input is not valid JSON
    • parse

      public void parse(Reader reader) throws IOException
      Reads the entire input from the given reader and parses it as JSON. The input must contain a valid JSON value, optionally padded with whitespace.

      Characters are read in chunks into a default-sized input buffer. Hence, wrapping a reader in an additional BufferedReader likely won't improve reading performance.

      Parameter:
      reader - the reader to read the input from
      Löst aus:
      IOException - if an I/O error occurs in the reader
      ParseException - if the input is not valid JSON
    • parse

      public void parse(Reader reader, int buffersize) throws IOException
      Reads the entire input from the given reader and parses it as JSON. The input must contain a valid JSON value, optionally padded with whitespace.

      Characters are read in chunks into an input buffer of the given size. Hence, wrapping a reader in an additional BufferedReader likely won't improve reading performance.

      Parameter:
      reader - the reader to read the input from
      buffersize - the size of the input buffer in chars
      Löst aus:
      IOException - if an I/O error occurs in the reader
      ParseException - if the input is not valid JSON