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
FieldsModifier and TypeFieldDescriptionstatic final JacksonReaderprivate static final com.fasterxml.jackson.core.JsonFactorystatic final JacksonReaderprivate final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Documentparse(com.fasterxml.jackson.core.JsonParser parser) private ArrayparseArray(com.fasterxml.jackson.core.JsonParser parser, boolean nested) private DocumentparseDocument(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, waitMethods 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:DocumentReaderRead a document from the supplied stream.- Specified by:
readin 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:DocumentReaderRead a document from the suppliedReader.- Specified by:
readin 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:DocumentReaderRead a document from the supplied JSON-formatted string.- Specified by:
readin 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:DocumentReaderRead a document from the supplied file.- Specified by:
readin 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:DocumentReaderRead a document from the content at the given URL.- Specified by:
readin 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:DocumentReaderRead a document from the supplied bytes.- Specified by:
readin 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:ArrayReaderRead an array from the supplied stream.- Specified by:
readArrayin 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:ArrayReaderRead an array from the suppliedReader.- Specified by:
readArrayin 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:ArrayReaderRead an array from the content at the given URL.- Specified by:
readArrayin 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:ArrayReaderRead an array from the supplied file.- Specified by:
readArrayin 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:ArrayReaderRead an array from the supplied JSON-formatted string.- Specified by:
readArrayin 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
-