Class JsonStreamParser.Builder
- java.lang.Object
-
- com.couchbase.client.core.json.stream.JsonStreamParser.Builder
-
- Enclosing class:
- JsonStreamParser
public static class JsonStreamParser.Builder extends Object
Builder instances are reusable provided that ALL configuration of the instance occurs before any call tobuild()
.Not thread safe.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonStreamParser
build()
Return a new parser using the builder's configuration.JsonStreamParser
build(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf scratchBuffer, StreamWindow window)
Return a new parser that uses the given scratch buffer and stream window.JsonStreamParser.Builder
doOnValue(String jsonPointer, Consumer<MatchedValue> callback)
Register a callback to invoke when the target of the JSON pointer is found.
-
-
-
Method Detail
-
doOnValue
public JsonStreamParser.Builder doOnValue(String jsonPointer, Consumer<MatchedValue> callback)
Register a callback to invoke when the target of the JSON pointer is found.The JSON pointer path component "-" (which normally refers to the non-existent array element after the end) is interpreted as a wildcard that matches every element.
-
build
public JsonStreamParser build()
Return a new parser using the builder's configuration. May be called repeatedly to get fresh parsers with the same configuration.
-
build
public JsonStreamParser build(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf scratchBuffer, StreamWindow window)
Return a new parser that uses the given scratch buffer and stream window. May be called repeatedly to get fresh parsers with the same configuration, but care must be taken to ensure only one parser is using the scratch buffer at a time.- Parameters:
scratchBuffer
- for readingwindow
- for allocating the stream window's composite buffer.
-
-