@ThreadSafe final class JacksonWriter extends Object implements DocumentWriter, ArrayWriter
DocumentWriter and ArrayWriter that uses the Jackson library to write JSON.| Modifier and Type | Class and Description |
|---|---|
protected static class |
JacksonWriter.WritingError |
| Modifier and Type | Field and Description |
|---|---|
private static com.fasterxml.jackson.core.JsonFactory |
factory |
static JacksonWriter |
INSTANCE |
private boolean |
pretty |
static JacksonWriter |
PRETTY_WRITER |
| Modifier | Constructor and Description |
|---|---|
private |
JacksonWriter(boolean pretty) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
configure(com.fasterxml.jackson.core.JsonGenerator generator) |
String |
write(Array array)
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(Array array,
Writer jsonWriter)
Write the supplied array to bytes using UTF-8.
|
String |
write(Document document)
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(Document document,
Writer jsonWriter)
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdefaultWriter, prettyWriterdefaultWriter, prettyWriter, writeAsBytespublic static final JacksonWriter INSTANCE
public static final JacksonWriter PRETTY_WRITER
private static final com.fasterxml.jackson.core.JsonFactory factory
private final boolean pretty
public void write(Document document, OutputStream jsonStream) throws IOException
DocumentWriterwrite in interface DocumentWriterdocument - the array to be written; may not be nulljsonStream - the stream to which the document is to be written; may not be nullIOException - if a document could not be written to the supplied streampublic void write(Document document, Writer jsonWriter) throws IOException
DocumentWriterwrite in interface DocumentWriterdocument - the array to be written; may not be nulljsonWriter - the writer to which the document is to be written; may not be nullIOException - if a document could not be written to the supplied streampublic String write(Document document) throws IOException
DocumentWriterwrite in interface DocumentWriterdocument - the document to be written; may not be nullIOException - if a document could not be written to the supplied streampublic byte[] writeAsBytes(Document document)
DocumentWriterwriteAsBytes in interface DocumentWriterdocument - the document to be written; may not be nullpublic void write(Array array, OutputStream jsonStream) throws IOException
ArrayWriterwrite in interface ArrayWriterarray - the array to be written; may not be nulljsonStream - the stream to which the array is to be written; may not be nullIOException - if an array could not be written to the supplied streampublic void write(Array array, Writer jsonWriter) throws IOException
ArrayWriterwrite in interface ArrayWriterarray - the array to be written; may not be nulljsonWriter - the IO writer to which the array is to be written; may not be nullIOException - if an array could not be written to the supplied streampublic String write(Array array) throws IOException
ArrayWriterwrite in interface ArrayWriterarray - the array to be written; may not be nullIOException - if an array could not be written to the supplied streamprotected void configure(com.fasterxml.jackson.core.JsonGenerator generator)
protected void writeDocument(Document document, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOExceptionprotected void writeArray(Array array, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOExceptionprotected void writeValue(Value value, com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOExceptionCopyright © 2016 JBoss by Red Hat. All rights reserved.