java.lang.Object
org.springframework.boot.buildpack.platform.json.JsonStream

public class JsonStream extends Object
Utility class that allows JSON to be parsed and processed as it's received.
Since:
2.3.0
Author:
Phillip Webb
  • Constructor Details

    • JsonStream

      public JsonStream(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Create a new JsonStream backed by the given object mapper.
      Parameters:
      objectMapper - the object mapper to use
  • Method Details

    • get

      public void get(InputStream content, Consumer<com.fasterxml.jackson.databind.node.ObjectNode> consumer) throws IOException
      Stream object nodes from the content as they become available.
      Parameters:
      content - the source content
      consumer - the ObjectNode consumer
      Throws:
      IOException - on IO error
    • get

      public <T> void get(InputStream content, Class<T> type, Consumer<T> consumer) throws IOException
      Stream objects from the content as they become available.
      Type Parameters:
      T - the object type
      Parameters:
      content - the source content
      type - the object type
      consumer - the ObjectNode consumer
      Throws:
      IOException - on IO error