JacksonSource
Provides helpers for creating fs2.Stream
and Iterator
instances of JsonEvent
from various underlying event sources,
using the Jackson library as the underlying event parser.
The helpers in this object operate in terms of the IntoJacksonJsonParser
typeclass, which defines logic for
using a source
value to construct a Jackson JsonParser in a Resource. From there, the helpers take care of
converting the jackson parser/event model to the spac JsonEvent model.
For example:
val file = new File("./stuff.json")
val jsonStream: Stream[IO, JsonEvent] = JacksonSource[IO](file)
Value members
Concrete methods
Wrap an existing Jackson JsonParser as a single-use source of JsonEvents.
Wrap an existing Jackson JsonParser as a single-use source of JsonEvents.
The source will not attempt to close the underlying parser.
- Value parameters:
- jacksonParser
A Jackson JsonParser
- Returns:
A single-use JSON event source
Creates a new Source that reads JsonEvents from the given file.
Creates a new Source that reads JsonEvents from the given file.
- Value parameters:
- factory
A Jackson JsonFactory used to construct the underlying JsonParser for the string
- file
A JSON file
- Returns:
A reusable JSON event source
Wrap an InputStream as a single-use source of JsonEvents.
Wrap an InputStream as a single-use source of JsonEvents.
The Source will not attempt to close the input stream.
- Value parameters:
- factory
A Jackson JsonFactory used to construct the underlying JsonParser for the string
- stream
An InputStream over raw JSON bytes
- Returns:
A single-use JSON event source
Wrap a Reader
as a single-use source of JsonEvents.
Wrap a Reader
as a single-use source of JsonEvents.
The Source will not attempt to close the reader.
- Value parameters:
- factory
A Jackson JsonFactory used to construct the underlying JsonParser for the string
- reader
A Reader over characters of raw JSON
- Returns:
A single-use JSON event source
Concrete fields
Default JsonFactory
used by the helpers in this object when interfacing with the IntoJacksonJsonParser
typeclass
to create the underlying Jackson JsonParsers.
Default JsonFactory
used by the helpers in this object when interfacing with the IntoJacksonJsonParser
typeclass
to create the underlying Jackson JsonParsers.
This is a new JsonFactory
with no additional modifications.