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 org.codehaus.jackson.JsonFactory |
factory |
private org.codehaus.jackson.JsonGenerator |
generator |
private Supplier<DateFormat> |
LAZY_DATE_FORMAT |
private Supplier<DateFormat> |
LAZY_TIME_FORMAT |
private Supplier<DateFormat> |
LAZY_TIMESTAMP_FORMAT |
private ComponentLog |
logger |
private NullSuppression |
nullSuppression |
private RecordSchema |
recordSchema |
private SchemaAccessWriter |
schemaAccess |
Constructor and Description |
---|
WriteJsonResult(ComponentLog logger,
RecordSchema recordSchema,
SchemaAccessWriter schemaAccess,
OutputStream out,
boolean prettyPrint,
NullSuppression nullSuppression,
String dateFormat,
String timeFormat,
String timestampFormat) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
String |
getMimeType() |
private boolean |
isFieldPresent(RecordField field,
Record record) |
protected void |
onBeginRecordSet() |
protected Map<String,String> |
onFinishRecordSet() |
private void |
writeArray(Object[] values,
String fieldName,
org.codehaus.jackson.JsonGenerator generator,
DataType elementType) |
WriteResult |
writeRawRecord(Record record) |
private void |
writeRawValue(org.codehaus.jackson.JsonGenerator generator,
Object value,
String fieldName) |
Map<String,String> |
writeRecord(Record record) |
private void |
writeRecord(Record record,
RecordSchema writeSchema,
org.codehaus.jackson.JsonGenerator generator,
WriteJsonResult.GeneratorTask startTask,
WriteJsonResult.GeneratorTask endTask,
boolean schemaAware) |
private void |
writeValue(org.codehaus.jackson.JsonGenerator generator,
Object value,
String fieldName,
DataType dataType) |
beginRecordSet, finishRecordSet, getOutputStream, getRecordCount, incrementRecordCount, isActiveRecordSet, write, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
beginRecordSet, finishRecordSet, write
write
private final ComponentLog logger
private final SchemaAccessWriter schemaAccess
private final RecordSchema recordSchema
private final org.codehaus.jackson.JsonFactory factory
private final org.codehaus.jackson.JsonGenerator generator
private final NullSuppression nullSuppression
private final Supplier<DateFormat> LAZY_DATE_FORMAT
private final Supplier<DateFormat> LAZY_TIME_FORMAT
private final Supplier<DateFormat> LAZY_TIMESTAMP_FORMAT
public WriteJsonResult(ComponentLog logger, RecordSchema recordSchema, SchemaAccessWriter schemaAccess, OutputStream out, boolean prettyPrint, NullSuppression nullSuppression, String dateFormat, String timeFormat, String timestampFormat) throws IOException
IOException
protected void onBeginRecordSet() throws IOException
onBeginRecordSet
in class AbstractRecordSetWriter
IOException
protected Map<String,String> onFinishRecordSet() throws IOException
onFinishRecordSet
in class AbstractRecordSetWriter
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractRecordSetWriter
IOException
public void flush() throws IOException
flush
in interface RecordWriter
flush
in class AbstractRecordSetWriter
IOException
public Map<String,String> writeRecord(Record record) throws IOException
writeRecord
in class AbstractRecordSetWriter
IOException
public WriteResult writeRawRecord(Record record) throws IOException
writeRawRecord
in interface RawRecordWriter
IOException
private void writeRecord(Record record, RecordSchema writeSchema, org.codehaus.jackson.JsonGenerator generator, WriteJsonResult.GeneratorTask startTask, WriteJsonResult.GeneratorTask endTask, boolean schemaAware) throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
IOException
private boolean isFieldPresent(RecordField field, Record record)
private void writeRawValue(org.codehaus.jackson.JsonGenerator generator, Object value, String fieldName) throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
IOException
private void writeValue(org.codehaus.jackson.JsonGenerator generator, Object value, String fieldName, DataType dataType) throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
IOException
private void writeArray(Object[] values, String fieldName, org.codehaus.jackson.JsonGenerator generator, DataType elementType) throws org.codehaus.jackson.JsonGenerationException, IOException
org.codehaus.jackson.JsonGenerationException
IOException
public String getMimeType()
getMimeType
in interface RecordWriter
Copyright © 2018 Apache NiFi Project. All rights reserved.