Class JsonStream
java.lang.Object
org.springframework.boot.buildpack.platform.json.JsonStream
Utility class that allows JSON to be parsed and processed as it's received.
- Since:
- 2.3.0
- Author:
- Phillip Webb
-
Constructor Summary
ConstructorsConstructorDescriptionJsonStream(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a newJsonStreambacked by the given object mapper. -
Method Summary
Modifier and TypeMethodDescription<T> voidget(InputStream content, Class<T> type, Consumer<T> consumer) Stream objects from the content as they become available.voidget(InputStream content, Consumer<com.fasterxml.jackson.databind.node.ObjectNode> consumer) Streamobject nodesfrom the content as they become available.
-
Constructor Details
-
JsonStream
public JsonStream(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a newJsonStreambacked 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 Streamobject nodesfrom the content as they become available.- Parameters:
content- the source contentconsumer- theObjectNodeconsumer- Throws:
IOException- on IO error
-
get
Stream objects from the content as they become available.- Type Parameters:
T- the object type- Parameters:
content- the source contenttype- the object typeconsumer- theObjectNodeconsumer- Throws:
IOException- on IO error
-