public class WriteJsonResult extends AbstractRecordSetWriter implements RecordSetWriter
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 RecordSchema |
recordSchema |
private SchemaAccessWriter |
schemaAccess |
Constructor and Description |
---|
WriteJsonResult(ComponentLog logger,
RecordSchema recordSchema,
SchemaAccessWriter schemaAccess,
OutputStream out,
boolean prettyPrint,
String dateFormat,
String timeFormat,
String timestampFormat) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
String |
getMimeType() |
protected void |
onBeginRecordSet() |
protected Map<String,String> |
onFinishRecordSet() |
private void |
writeArray(Object[] values,
String fieldName,
org.codehaus.jackson.JsonGenerator generator,
DataType elementType) |
Map<String,String> |
writeRecord(Record record) |
private void |
writeRecord(Record record,
RecordSchema writeSchema,
org.codehaus.jackson.JsonGenerator generator,
WriteJsonResult.GeneratorTask startTask,
WriteJsonResult.GeneratorTask endTask) |
private void |
writeValue(org.codehaus.jackson.JsonGenerator generator,
Object value,
String fieldName,
DataType dataType,
boolean moreCols) |
beginRecordSet, finishRecordSet, getOutputStream, getRecordCount, 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 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, 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
private void writeRecord(Record record, RecordSchema writeSchema, org.codehaus.jackson.JsonGenerator generator, WriteJsonResult.GeneratorTask startTask, WriteJsonResult.GeneratorTask endTask) 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, boolean moreCols) 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 © 2017 Apache NiFi Project. All rights reserved.