public interface JsonParser extends Handler<Buffer>, ReadStream<JsonEvent>
exceptionHandler(Handler)
is called with
the cause of the failure and the current handling stops. After such event, the parser should not handle data
anymore.Modifier and Type | Method and Description |
---|---|
JsonParser |
arrayEventMode()
Flip the parser to emit a stream of events for each new json array.
|
JsonParser |
arrayValueMode()
Flip the parser to emit a single value event for each new json array.
|
void |
end()
End the stream, this must be called after all the json stream has been processed.
|
JsonParser |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
JsonParser |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
JsonParser |
fetch(long amount)
Fetch the specified
amount of elements. |
JsonParser |
handler(Handler<JsonEvent> handler)
Set a data handler.
|
static JsonParser |
newParser()
Create a new
JsonParser instance. |
static JsonParser |
newParser(ReadStream<Buffer> stream)
Create a new
JsonParser instance. |
JsonParser |
objectEventMode()
Flip the parser to emit a stream of events for each new json object.
|
JsonParser |
objectValueMode()
Flip the parser to emit a single value event for each new json object.
|
JsonParser |
pause()
Pause the
ReadStream , it sets the buffer in fetch mode and clears the actual demand. |
JsonParser |
resume()
Resume reading, and sets the buffer in
flowing mode. |
JsonParser |
write(Buffer buffer)
Handle a
Buffer , pretty much like calling Handler.handle(Object) . |
collect, pipe, pipeTo, pipeTo
static JsonParser newParser()
JsonParser
instance.static JsonParser newParser(ReadStream<Buffer> stream)
JsonParser
instance.JsonParser write(Buffer buffer)
Buffer
, pretty much like calling Handler.handle(Object)
.void end()
JsonParser objectEventMode()
JsonParser objectValueMode()
JsonParser arrayEventMode()
JsonParser arrayValueMode()
JsonParser pause()
ReadStream
ReadStream
, it sets the buffer in fetch
mode and clears the actual demand.
While it's paused, no data will be sent to the data handler
.
pause
in interface ReadStream<JsonEvent>
JsonParser resume()
ReadStream
flowing
mode.
If the ReadStream
has been paused, reading will recommence on it.resume
in interface ReadStream<JsonEvent>
JsonParser fetch(long amount)
ReadStream
amount
of elements. If the ReadStream
has been paused, reading will
recommence with the specified amount
of items, otherwise the specified amount
will
be added to the current stream demand.fetch
in interface ReadStream<JsonEvent>
JsonParser endHandler(Handler<Void> endHandler)
ReadStream
endHandler
in interface ReadStream<JsonEvent>
JsonParser handler(Handler<JsonEvent> handler)
ReadStream
handler
in interface ReadStream<JsonEvent>
JsonParser exceptionHandler(Handler<Throwable> handler)
ReadStream
exceptionHandler
in interface ReadStream<JsonEvent>
exceptionHandler
in interface StreamBase
handler
- the exception handlerCopyright © 2024 Eclipse. All rights reserved.