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 also parses concatenated json streams or line delimited json streams.
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 @see \io\vertx\jphp\core\parsetools\JsonParser::exceptionHandler is called with the cause of the failure and the current handling stops. After such event, the parser should not handle data anymore.
package |
Default |
---|
__construct()
arrayEventMode() : $this
$this
a reference to this, so the API can be used fluently
arrayValueMode() : $this
$this
a reference to this, so the API can be used fluently
end() : void
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
handle( $arg0) : void
Buffer
handler( $arg0) : $this
callable
$this
newParser( $arg0 = null) : \io\vertx\jphp\core\parsetools\JsonParser
newParser()
Create a new JsonParser
instance.
param $stream [ReadStream
ReadStream
\io\vertx\jphp\core\parsetools\JsonParser
objectEventMode() : $this
$this
a reference to this, so the API can be used fluently
objectValueMode() : $this
$this
a reference to this, so the API can be used fluently
pause() : $this
$this
pipe() : \io\vertx\jphp\core\parsetools\Pipe<JsonEvent>
The stream will be resumed when the pipe will be wired to a WriteStream
.
\io\vertx\jphp\core\parsetools\Pipe
a pipe
pipeTo( $arg0, $arg1 = null) : void
param $dst [WriteStream
Pipe this ReadStream
to the WriteStream
.
Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the handler
will be
called with the result.
param $dst [WriteStream
WriteStream
callable
resume() : $this
$this
write( $arg0) : $this
Buffer
$this
a reference to this, so the API can be used fluently