Class JsonParser
- java.lang.Object
- 
- io.vertx.mutiny.core.parsetools.JsonParser
 
- 
- All Implemented Interfaces:
- io.vertx.core.Handler<Buffer>,- ReadStream<JsonEvent>,- StreamBase,- Consumer<Buffer>
 
 public class JsonParser extends Object implements ReadStream<JsonEvent>, io.vertx.core.Handler<Buffer>, Consumer<Buffer> 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, theexceptionHandler(java.util.function.Consumer<java.lang.Throwable>)is called with the cause of the failure and the current handling stops. After such event, the parser should not handle data anymore. NOTE: This class has been automatically generated from theoriginalnon Mutiny-ified interface using Vert.x codegen.
- 
- 
Field SummaryFields Modifier and Type Field Description static TypeArg<JsonParser>__TYPE_ARG
 - 
Constructor SummaryConstructors Constructor Description JsonParser(io.vertx.core.parsetools.JsonParser delegate)JsonParser(Object delegate)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Buffer item)JsonParserarrayEventMode()JsonParserarrayValueMode()voidend()JsonParserendHandler(Runnable endHandler)booleanequals(Object o)JsonParserexceptionHandler(Consumer<Throwable> handler)JsonParserfetch(long amount)io.vertx.core.parsetools.JsonParsergetDelegate()voidhandle(Buffer event)JsonParserhandler(Consumer<JsonEvent> handler)inthashCode()static JsonParsernewInstance(io.vertx.core.parsetools.JsonParser arg)static JsonParsernewParser()static JsonParsernewParser(ReadStream<Buffer> stream)static JsonParsernewParser(org.reactivestreams.Publisher<Buffer> stream)JsonParserobjectEventMode()JsonParserobjectValueMode()JsonParserpause()Pipe<JsonEvent>pipe()io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<JsonEvent> dst)Pipe thisReadStreamto theWriteStream.VoidpipeToAndAwait(WriteStream<JsonEvent> dst)Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream.) voidpipeToAndForget(WriteStream<JsonEvent> dst)Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat ignores the result of the operation.) JsonParserresume()Iterable<JsonEvent>toBlockingIterable()Stream<JsonEvent>toBlockingStream()io.smallrye.mutiny.Multi<JsonEvent>toMulti()StringtoString()JsonParserwrite(Buffer buffer)
 
- 
- 
- 
Field Detail- 
__TYPE_ARGpublic static final TypeArg<JsonParser> __TYPE_ARG 
 
- 
 - 
Constructor Detail- 
JsonParserpublic JsonParser(io.vertx.core.parsetools.JsonParser delegate) 
 - 
JsonParserpublic JsonParser(Object delegate) 
 
- 
 - 
Method Detail- 
getDelegatepublic io.vertx.core.parsetools.JsonParser getDelegate() - Specified by:
- getDelegatein interface- ReadStream<JsonEvent>
- Specified by:
- getDelegatein interface- StreamBase
 
 - 
handlepublic void handle(Buffer event) - Specified by:
- handlein interface- io.vertx.core.Handler<Buffer>
- Parameters:
- event- the event to handle
 
 - 
pipepublic Pipe<JsonEvent> pipe() - Specified by:
- pipein interface- ReadStream<JsonEvent>
- Returns:
- a pipe
 
 - 
pipeTo@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<JsonEvent> dst) Pipe thisReadStreamto theWriteStream.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 handlerwill be called with the result.Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.- Specified by:
- pipeToin interface- ReadStream<JsonEvent>
- Parameters:
- dst- the destination write stream
- Returns:
- the unifiring the result of the operation when completed, or a failure if the operation failed.
 
 - 
pipeToAndAwaitpublic Void pipeToAndAwait(WriteStream<JsonEvent> dst) Blocking variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream.) This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException). - Specified by:
- pipeToAndAwaitin interface- ReadStream<JsonEvent>
- Parameters:
- dst- the destination write stream
- Returns:
- the Void instance produced by the operation.
 
 - 
pipeToAndForgetpublic void pipeToAndForget(WriteStream<JsonEvent> dst) Variant ofio.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreamthat ignores the result of the operation.) This method subscribes on the result of io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStream, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from) io.vertx.mutiny.core.streams.ReadStream#pipeTo(io.vertx.mutiny.core.streams.WriteStreambut you don't need to compose it with other operations.) - Specified by:
- pipeToAndForgetin interface- ReadStream<JsonEvent>
- Parameters:
- dst- the destination write stream
 
 - 
newParserpublic static JsonParser newParser() - Returns:
 
 - 
newParserpublic static JsonParser newParser(ReadStream<Buffer> stream) - Parameters:
- stream-
- Returns:
 
 - 
newParserpublic static JsonParser newParser(org.reactivestreams.Publisher<Buffer> stream) - Parameters:
- stream-
- Returns:
 
 - 
writepublic JsonParser write(Buffer buffer) - Parameters:
- buffer-
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
endpublic void end() 
 - 
objectEventModepublic JsonParser objectEventMode() - Returns:
- a reference to this, so the API can be used fluently
 
 - 
objectValueModepublic JsonParser objectValueMode() - Returns:
- a reference to this, so the API can be used fluently
 
 - 
arrayEventModepublic JsonParser arrayEventMode() - Returns:
- a reference to this, so the API can be used fluently
 
 - 
arrayValueModepublic JsonParser arrayValueMode() - Returns:
- a reference to this, so the API can be used fluently
 
 - 
pausepublic JsonParser pause() - Specified by:
- pausein interface- ReadStream<JsonEvent>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
resumepublic JsonParser resume() - Specified by:
- resumein interface- ReadStream<JsonEvent>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
fetchpublic JsonParser fetch(long amount) - Specified by:
- fetchin interface- ReadStream<JsonEvent>
- Returns:
- a reference to this, so the API can be used fluently
 
 - 
endHandlerpublic JsonParser endHandler(Runnable endHandler) - Specified by:
- endHandlerin interface- ReadStream<JsonEvent>
- Returns:
 
 - 
handlerpublic JsonParser handler(Consumer<JsonEvent> handler) - Specified by:
- handlerin interface- ReadStream<JsonEvent>
- Returns:
 
 - 
exceptionHandlerpublic JsonParser exceptionHandler(Consumer<Throwable> handler) - Specified by:
- exceptionHandlerin interface- ReadStream<JsonEvent>
- Specified by:
- exceptionHandlerin interface- StreamBase
- Parameters:
- handler- the exception handler
- Returns:
 
 - 
toMulti@CheckReturnValue public io.smallrye.mutiny.Multi<JsonEvent> toMulti() - Specified by:
- toMultiin interface- ReadStream<JsonEvent>
 
 - 
newInstancepublic static JsonParser newInstance(io.vertx.core.parsetools.JsonParser arg) 
 
- 
 
-