public class WriteJsonResult extends AbstractRecordSetWriter implements RecordSetWriter, RawRecordWriter
| Modifier and Type | Class and Description |
|---|---|
private static interface |
WriteJsonResult.GeneratorTask |
| Modifier and Type | Field and Description |
|---|---|
private com.fasterxml.jackson.core.JsonGenerator |
generator |
private Supplier<DateFormat> |
LAZY_DATE_FORMAT |
private Supplier<DateFormat> |
LAZY_TIME_FORMAT |
private Supplier<DateFormat> |
LAZY_TIMESTAMP_FORMAT |
private org.apache.nifi.logging.ComponentLog |
logger |
private String |
mimeType |
private NullSuppression |
nullSuppression |
private static com.fasterxml.jackson.databind.ObjectMapper |
objectMapper |
private OutputGrouping |
outputGrouping |
private RecordSchema |
recordSchema |
private SchemaAccessWriter |
schemaAccess |
| Constructor and Description |
|---|
WriteJsonResult(org.apache.nifi.logging.ComponentLog logger,
RecordSchema recordSchema,
SchemaAccessWriter schemaAccess,
OutputStream out,
boolean prettyPrint,
NullSuppression nullSuppression,
OutputGrouping outputGrouping,
String dateFormat,
String timeFormat,
String timestampFormat) |
WriteJsonResult(org.apache.nifi.logging.ComponentLog logger,
RecordSchema recordSchema,
SchemaAccessWriter schemaAccess,
OutputStream out,
boolean prettyPrint,
NullSuppression nullSuppression,
OutputGrouping outputGrouping,
String dateFormat,
String timeFormat,
String timestampFormat,
String mimeType) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
private Object |
format(Date value,
Supplier<DateFormat> formatSupplier) |
String |
getMimeType() |
private boolean |
isFieldPresent(RecordField field,
Record record) |
protected void |
onBeginRecordSet() |
protected Map<String,String> |
onFinishRecordSet() |
private void |
writeArray(Object[] values,
String fieldName,
com.fasterxml.jackson.core.JsonGenerator generator,
DataType elementType) |
WriteResult |
writeRawRecord(Record record) |
private void |
writeRawValue(com.fasterxml.jackson.core.JsonGenerator generator,
Object value,
String fieldName) |
Map<String,String> |
writeRecord(Record record) |
private void |
writeRecord(Record record,
RecordSchema writeSchema,
com.fasterxml.jackson.core.JsonGenerator generator,
WriteJsonResult.GeneratorTask startTask,
WriteJsonResult.GeneratorTask endTask,
boolean schemaAware) |
private void |
writeValue(com.fasterxml.jackson.core.JsonGenerator generator,
Object value,
String fieldName,
DataType dataType) |
beginRecordSet, finishRecordSet, getOutputStream, getRecordCount, incrementRecordCount, isActiveRecordSet, write, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbeginRecordSet, finishRecordSet, writewriteprivate final org.apache.nifi.logging.ComponentLog logger
private final SchemaAccessWriter schemaAccess
private final RecordSchema recordSchema
private final com.fasterxml.jackson.core.JsonGenerator generator
private final NullSuppression nullSuppression
private final OutputGrouping outputGrouping
private final Supplier<DateFormat> LAZY_DATE_FORMAT
private final Supplier<DateFormat> LAZY_TIME_FORMAT
private final Supplier<DateFormat> LAZY_TIMESTAMP_FORMAT
private String mimeType
private static final com.fasterxml.jackson.databind.ObjectMapper objectMapper
public WriteJsonResult(org.apache.nifi.logging.ComponentLog logger, RecordSchema recordSchema, SchemaAccessWriter schemaAccess, OutputStream out, boolean prettyPrint, NullSuppression nullSuppression, OutputGrouping outputGrouping, String dateFormat, String timeFormat, String timestampFormat) throws IOException
IOExceptionpublic WriteJsonResult(org.apache.nifi.logging.ComponentLog logger, RecordSchema recordSchema, SchemaAccessWriter schemaAccess, OutputStream out, boolean prettyPrint, NullSuppression nullSuppression, OutputGrouping outputGrouping, String dateFormat, String timeFormat, String timestampFormat, String mimeType) throws IOException
IOExceptionprotected void onBeginRecordSet()
throws IOException
onBeginRecordSet in class AbstractRecordSetWriterIOExceptionprotected Map<String,String> onFinishRecordSet() throws IOException
onFinishRecordSet in class AbstractRecordSetWriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractRecordSetWriterIOExceptionpublic void flush()
throws IOException
flush in interface RecordWriterflush in class AbstractRecordSetWriterIOExceptionpublic Map<String,String> writeRecord(Record record) throws IOException
writeRecord in class AbstractRecordSetWriterIOExceptionpublic WriteResult writeRawRecord(Record record) throws IOException
writeRawRecord in interface RawRecordWriterIOExceptionprivate void writeRecord(Record record, RecordSchema writeSchema, com.fasterxml.jackson.core.JsonGenerator generator, WriteJsonResult.GeneratorTask startTask, WriteJsonResult.GeneratorTask endTask, boolean schemaAware) throws IOException
IOExceptionprivate boolean isFieldPresent(RecordField field, Record record)
private void writeRawValue(com.fasterxml.jackson.core.JsonGenerator generator,
Object value,
String fieldName)
throws IOException
IOExceptionprivate Object format(Date value, Supplier<DateFormat> formatSupplier)
private void writeValue(com.fasterxml.jackson.core.JsonGenerator generator,
Object value,
String fieldName,
DataType dataType)
throws IOException
IOExceptionprivate void writeArray(Object[] values, String fieldName, com.fasterxml.jackson.core.JsonGenerator generator, DataType elementType) throws IOException
IOExceptionpublic String getMimeType()
getMimeType in interface RecordWriterCopyright © 2023 Apache NiFi Project. All rights reserved.