Package io.debezium.document
Class JacksonWriter
java.lang.Object
io.debezium.document.JacksonWriter
- All Implemented Interfaces:
ArrayWriter
,DocumentWriter
A
DocumentWriter
and ArrayWriter
that uses the Jackson library to write JSON.- Author:
- Randall Hauch
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final com.fasterxml.jackson.core.JsonFactory
static final JacksonWriter
private final boolean
static final JacksonWriter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
configure
(com.fasterxml.jackson.core.JsonGenerator generator) Write the supplied array to a string using UTF-8.void
write
(Array array, OutputStream jsonStream) Write the supplied array to bytes using UTF-8.void
Write the supplied array to bytes using UTF-8.Write the supplied document to a string using UTF-8.void
write
(Document document, OutputStream jsonStream) Write the supplied document to bytes using UTF-8.void
Write the supplied document to bytes using UTF-8.protected void
writeArray
(Array array, com.fasterxml.jackson.core.JsonGenerator generator) byte[]
writeAsBytes
(Document document) Write the supplied array to bytes using UTF-8.protected void
writeDocument
(Document document, com.fasterxml.jackson.core.JsonGenerator generator) protected void
writeValue
(Value value, com.fasterxml.jackson.core.JsonGenerator generator) 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.ArrayWriter
writeAsBytes
-
Field Details
-
INSTANCE
-
PRETTY_WRITER
-
factory
private static final com.fasterxml.jackson.core.JsonFactory factory -
pretty
private final boolean pretty
-
-
Constructor Details
-
JacksonWriter
private JacksonWriter(boolean pretty)
-
-
Method Details
-
write
Description copied from interface:DocumentWriter
Write the supplied document to bytes using UTF-8.- Specified by:
write
in interfaceDocumentWriter
- Parameters:
document
- the array to be written; may not be nulljsonStream
- the stream to which the document is to be written; may not be null- Throws:
IOException
- if a document could not be written to the supplied stream
-
write
Description copied from interface:DocumentWriter
Write the supplied document to bytes using UTF-8.- Specified by:
write
in interfaceDocumentWriter
- Parameters:
document
- the array to be written; may not be nulljsonWriter
- the writer to which the document is to be written; may not be null- Throws:
IOException
- if a document could not be written to the supplied stream
-
write
Description copied from interface:DocumentWriter
Write the supplied document to a string using UTF-8.- Specified by:
write
in interfaceDocumentWriter
- Parameters:
document
- the document to be written; may not be null- Returns:
- the string containing the output JSON-formatted document; never null
- Throws:
IOException
- if a document could not be written to the supplied stream
-
writeAsBytes
Description copied from interface:DocumentWriter
Write the supplied array to bytes using UTF-8.- Specified by:
writeAsBytes
in interfaceDocumentWriter
- Parameters:
document
- the document to be written; may not be null- Returns:
- the bytes containing the output JSON-formatted document; never null
-
write
Description copied from interface:ArrayWriter
Write the supplied array to bytes using UTF-8.- Specified by:
write
in interfaceArrayWriter
- Parameters:
array
- the array to be written; may not be nulljsonStream
- the stream to which the array is to be written; may not be null- Throws:
IOException
- if an array could not be written to the supplied stream
-
write
Description copied from interface:ArrayWriter
Write the supplied array to bytes using UTF-8.- Specified by:
write
in interfaceArrayWriter
- Parameters:
array
- the array to be written; may not be nulljsonWriter
- the IO writer to which the array is to be written; may not be null- Throws:
IOException
- if an array could not be written to the supplied stream
-
write
Description copied from interface:ArrayWriter
Write the supplied array to a string using UTF-8.- Specified by:
write
in interfaceArrayWriter
- Parameters:
array
- the array to be written; may not be null- Returns:
- the string containing the output JSON-formatted array; never null
- Throws:
IOException
- if an array could not be written to the supplied stream
-
configure
protected void configure(com.fasterxml.jackson.core.JsonGenerator generator) -
writeDocument
protected void writeDocument(Document document, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
IOException
-
writeArray
protected void writeArray(Array array, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
IOException
-
writeValue
protected void writeValue(Value value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException - Throws:
IOException
-