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 to build().

Not thread safe.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • 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 reading
      window - for allocating the stream window's composite buffer.