Package io.debezium.document
Class JacksonReader
java.lang.Object
io.debezium.document.JacksonReader
- All Implemented Interfaces:
ArrayReader
,DocumentReader
A
DocumentReader
and ArrayReader
that uses the Jackson library to read JSON.- Author:
- Randall Hauch
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JacksonReader
private static final com.fasterxml.jackson.core.JsonFactory
static final JacksonReader
private final boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate Document
parse
(com.fasterxml.jackson.core.JsonParser parser) private Array
parseArray
(com.fasterxml.jackson.core.JsonParser parser, boolean nested) private Document
parseDocument
(com.fasterxml.jackson.core.JsonParser parser, boolean nested) read
(byte[] rawBytes) Read a document from the supplied bytes.Read a document from the supplied file.read
(InputStream jsonStream) Read a document from the supplied stream.Read a document from the suppliedReader
.Read a document from the supplied JSON-formatted string.Read a document from the content at the given URL.Read an array from the supplied file.readArray
(InputStream jsonStream) Read an array from the supplied stream.Read an array from the suppliedReader
.Read an array from the supplied JSON-formatted string.Read an array from the content at the given URL.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.debezium.document.ArrayReader
readArray
-
Field Details
-
DEFAULT_INSTANCE
-
FLOAT_NUMBERS_AS_TEXT_INSTANCE
-
factory
private static final com.fasterxml.jackson.core.JsonFactory factory -
handleFloatNumbersAsText
private final boolean handleFloatNumbersAsText
-
-
Constructor Details
-
JacksonReader
private JacksonReader(boolean handleFloatNumbersAsText)
-
-
Method Details
-
read
Description copied from interface:DocumentReader
Read a document from the supplied stream.- Specified by:
read
in interfaceDocumentReader
- Parameters:
jsonStream
- the input stream to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied stream
-
read
Description copied from interface:DocumentReader
Read a document from the suppliedReader
.- Specified by:
read
in interfaceDocumentReader
- Parameters:
jsonReader
- the reader to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied reader
-
read
Description copied from interface:DocumentReader
Read a document from the supplied JSON-formatted string.- Specified by:
read
in interfaceDocumentReader
- Parameters:
json
- the JSON string representation to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied string
-
read
Description copied from interface:DocumentReader
Read a document from the supplied file.- Specified by:
read
in interfaceDocumentReader
- Parameters:
jsonFile
- the file to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied file
-
read
Description copied from interface:DocumentReader
Read a document from the content at the given URL.- Specified by:
read
in interfaceDocumentReader
- Parameters:
jsonUrl
- the URL to the content that is to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied content
-
read
Description copied from interface:DocumentReader
Read a document from the supplied bytes.- Specified by:
read
in interfaceDocumentReader
- Parameters:
rawBytes
- the UTF-8 bytes to be read; may not be null- Returns:
- the document instance; never null
- Throws:
IOException
- if a document could not be read from the supplied bytes
-
readArray
Description copied from interface:ArrayReader
Read an array from the supplied stream.- Specified by:
readArray
in interfaceArrayReader
- Parameters:
jsonStream
- the input stream to be read; may not be null- Returns:
- the array instance; never null
- Throws:
IOException
- if an array could not be read from the supplied stream
-
readArray
Description copied from interface:ArrayReader
Read an array from the suppliedReader
.- Specified by:
readArray
in interfaceArrayReader
- Parameters:
jsonReader
- the reader to be read; may not be null- Returns:
- the array instance; never null
- Throws:
IOException
- if an array could not be read from the supplied reader
-
readArray
Description copied from interface:ArrayReader
Read an array from the content at the given URL.- Specified by:
readArray
in interfaceArrayReader
- Parameters:
jsonUrl
- the URL to the content that is to be read; may not be null- Returns:
- the array instance; never null
- Throws:
IOException
- if an array could not be read from the supplied content
-
readArray
Description copied from interface:ArrayReader
Read an array from the supplied file.- Specified by:
readArray
in interfaceArrayReader
- Parameters:
jsonFile
- the file to be read; may not be null- Returns:
- the array instance; never null
- Throws:
IOException
- if an array could not be read from the supplied file
-
readArray
Description copied from interface:ArrayReader
Read an array from the supplied JSON-formatted string.- Specified by:
readArray
in interfaceArrayReader
- Parameters:
jsonArray
- the JSON string representation to be read; may not be null- Returns:
- the array instance; never null
- Throws:
IOException
- if an array could not be read from the supplied string
-
parse
- Throws:
IOException
-
parseDocument
private Document parseDocument(com.fasterxml.jackson.core.JsonParser parser, boolean nested) throws IOException - Throws:
IOException
-
parseArray
private Array parseArray(com.fasterxml.jackson.core.JsonParser parser, boolean nested) throws IOException - Throws:
IOException
-