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.AnythingJsonParserBasicIdentifiableObjectAnythingno subtypes hierarchy
| Initializer |
JsonParser(JsonParser unknown) |
| Inherited Attributes |
Attributes inherited from: Objecthash, string |
| Methods | |
arrayEventMode | shared default JsonParser arrayEventMode()Flip the parser to emit a stream of events for each new json array. |
arrayValueMode | shared 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. |
end | shared default void end()End the stream, this must be called after all the json stream has been processed. |
endHandler | shared 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. Refines ReadStream.endHandler |
exceptionHandler | shared actual default JsonParser exceptionHandler(Anything(Throwable)? handler)Set an exception handler. Refines StreamBase.exceptionHandler |
handle | shared default void handle(Buffer event)Something has happened, so handle it. Parameters:
|
handler | shared actual default JsonParser handler(Anything(JsonEvent)? handler)Set a data handler. As data is read, the handler will be called with the data. Refines ReadStream.handler |
objectEventMode | shared default JsonParser objectEventMode()Flip the parser to emit a stream of events for each new json object. |
objectValueMode | shared 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. |
pause | shared actual default JsonParser pause()Pause the Refines ReadStream.pause |
resume | shared actual default JsonParser resume()Resume reading. If the Refines ReadStream.resume |
write | shared default JsonParser write(Buffer buffer)Handle a |
| Inherited Methods |
Methods inherited from: Objectequals |
Methods inherited from: ReadStream<T> |
Methods inherited from: StreamBase |