Package org.apache.nifi.csv
Class WriteCSVResult
java.lang.Object
org.apache.nifi.serialization.AbstractRecordSetWriter
org.apache.nifi.csv.WriteCSVResult
- All Implemented Interfaces:
Closeable
,AutoCloseable
,RawRecordWriter
,RecordSetWriter
,RecordWriter
public class WriteCSVResult
extends AbstractRecordSetWriter
implements RecordSetWriter, RawRecordWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private String[]
private final Object[]
private boolean
private final boolean
private final org.apache.commons.csv.CSVPrinter
private final RecordSchema
private final SchemaAccessWriter
private final String
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionWriteCSVResult
(org.apache.commons.csv.CSVFormat csvFormat, RecordSchema recordSchema, SchemaAccessWriter schemaWriter, OutputStream out, String dateFormat, String timeFormat, String timestampFormat, boolean includeHeaderLine, String charSet) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
flush()
private String[]
getFieldNames
(Record record) private Object
getFieldValue
(Record record, RecordField recordField) private String
getFormat
(RecordField field) private void
includeHeaderIfNecessary
(Record record, boolean includeOnlySchemaFields) protected void
writeRawRecord
(Record record) writeRecord
(Record record) Methods inherited from class org.apache.nifi.serialization.AbstractRecordSetWriter
beginRecordSet, finishRecordSet, getOutputStream, getRecordCount, incrementRecordCount, isActiveRecordSet, write, write
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.nifi.serialization.RecordSetWriter
beginRecordSet, finishRecordSet, write
Methods inherited from interface org.apache.nifi.serialization.RecordWriter
write
-
Field Details
-
recordSchema
-
schemaWriter
-
dateFormat
-
timeFormat
-
timestampFormat
-
printer
private final org.apache.commons.csv.CSVPrinter printer -
fieldValues
-
includeHeaderLine
private final boolean includeHeaderLine -
headerWritten
private boolean headerWritten -
fieldNames
-
-
Constructor Details
-
WriteCSVResult
public WriteCSVResult(org.apache.commons.csv.CSVFormat csvFormat, RecordSchema recordSchema, SchemaAccessWriter schemaWriter, OutputStream out, String dateFormat, String timeFormat, String timestampFormat, boolean includeHeaderLine, String charSet) throws IOException - Throws:
IOException
-
-
Method Details
-
getFormat
-
onBeginRecordSet
- Overrides:
onBeginRecordSet
in classAbstractRecordSetWriter
- Throws:
IOException
-
onFinishRecordSet
- Overrides:
onFinishRecordSet
in classAbstractRecordSetWriter
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractRecordSetWriter
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceRecordWriter
- Overrides:
flush
in classAbstractRecordSetWriter
- Throws:
IOException
-
getFieldNames
-
includeHeaderIfNecessary
private void includeHeaderIfNecessary(Record record, boolean includeOnlySchemaFields) throws IOException - Throws:
IOException
-
writeRecord
- Specified by:
writeRecord
in classAbstractRecordSetWriter
- Throws:
IOException
-
getFieldValue
-
writeRawRecord
- Specified by:
writeRawRecord
in interfaceRawRecordWriter
- Throws:
IOException
-
getMimeType
- Specified by:
getMimeType
in interfaceRecordWriter
-