A parser class which allows to incrementally parse json elements and emit json parse events instead of parsing a json element fully. This parser is convenient for parsing large json structures.

The parser can also parse entire object or array when it is convenient, for instance a very large array of small objects can be parsed efficiently by handling array start/end and object events.

Whenever the parser fails to parse or process the stream, the exceptionHandler is called with the cause of the failure and the current handling stops. After such event, the parser should not handle data anymore.

no subtypes hierarchy

JsonParser(JsonParser unknown)
Inherited Attributes
Attributes inherited from: Object
hash, string
arrayEventModeshared default JsonParser arrayEventMode()

Flip the parser to emit a stream of events for each new json array.

arrayValueModeshared default JsonParser arrayValueMode()

Flip the parser to emit a single value event for each new json array.

Json array currently streamed won't be affected.

endshared default void end()

End the stream, this must be called after all the json stream has been processed.

endHandlershared actual default JsonParser endHandler(Anything()? endHandler)

Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.

exceptionHandlershared actual default JsonParser exceptionHandler(Anything(Throwable)? handler)

Set an exception handler.

handleshared default void handle(Buffer event)

Something has happened, so handle it.

  • event

    the event to handle

handlershared actual default JsonParser handler(Anything(JsonEvent)? handler)

Set a data handler. As data is read, the handler will be called with the data.

objectEventModeshared default JsonParser objectEventMode()

Flip the parser to emit a stream of events for each new json object.

objectValueModeshared default JsonParser objectValueMode()

Flip the parser to emit a single value event for each new json object.

Json object currently streamed won't be affected.

pauseshared actual default JsonParser pause()

Pause the ReadSupport. While it's paused, no data will be sent to the dataHandler

resumeshared actual default JsonParser resume()

Resume reading. If the ReadSupport has been paused, reading will recommence on it.

writeshared default JsonParser write(Buffer buffer)

Handle a Buffer, pretty much like calling handler.

Inherited Methods
Methods inherited from: Object
Methods inherited from: ReadStream<T>
Methods inherited from: StreamBase