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
ConstructorDescriptionJsonStream
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a newJsonStream
backed by the given object mapper. -
Method Summary
Modifier and TypeMethodDescription<T> void
get
(InputStream content, Class<T> type, Consumer<T> consumer) Stream objects from the content as they become available.void
get
(InputStream content, Consumer<com.fasterxml.jackson.databind.node.ObjectNode> consumer) Streamobject nodes
from the content as they become available.
-
Constructor Details
-
JsonStream
public JsonStream(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Create a newJsonStream
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 Streamobject nodes
from the content as they become available.- Parameters:
content
- the source contentconsumer
- theObjectNode
consumer- 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
- theObjectNode
consumer- Throws:
IOException
- on IO error
-