All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataWriterFactory, JavaCodeGenerator, Serializable

public class CsvPipelineOutput extends FileSinkPipelineOutput
Writes a pipeline's records to a CSV or other delimited FileSink using a CSVWriter.
See Also:
  • Constructor Details

    • CsvPipelineOutput

      public CsvPipelineOutput()
  • Method Details

    • getName

      public String getName()
      Description copied from class: PipelineOutput
      Returns a display name for this output, such as the destination's name followed by its format.
      Overrides:
      getName in class FileSinkPipelineOutput
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class Bean
    • fromRecord

      public CsvPipelineOutput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineOutput
      Parameters:
      source -
      Returns:
      this instance.
    • getFieldSeparator

      public String getFieldSeparator()
      Returns the string written between field values (defaults to comma).
    • setFieldSeparator

      public CsvPipelineOutput setFieldSeparator(String fieldSeparator)
      Sets the string written between field values (defaults to comma).
    • getStartingQuote

      public String getStartingQuote()
      Returns the string that starts a quoted value (defaults to a double quote).
    • setStartingQuote

      public CsvPipelineOutput setStartingQuote(String startingQuote)
      Sets the string that starts a quoted value (defaults to a double quote).
    • getEndingQuote

      public String getEndingQuote()
      Returns the string that ends a quoted value (defaults to a double quote).
    • setEndingQuote

      public CsvPipelineOutput setEndingQuote(String endingQuote)
      Sets the string that ends a quoted value (defaults to a double quote).
    • getNewLine

      public String getNewLine()
      Returns the string written after each record (defaults to the system line separator).
    • setNewLine

      public CsvPipelineOutput setNewLine(String newLine)
      Sets the string written after each record (defaults to the system line separator).
    • getNewLineEscaped

      public String getNewLineEscaped()
      Returns the line separator in Java-escaped form, as serialized.
    • setNewLineEscaped

      public CsvPipelineOutput setNewLineEscaped(String newLine)
      Sets the line separator from its Java-escaped form, as serialized.
    • getNullValuePolicy

      public CSVWriter.ValuePolicy getNullValuePolicy()
      Returns how null values are written (defaults to CSVWriter.ValuePolicy.EMPTY_STRING, an unquoted blank).
    • setNullValuePolicy

      public CsvPipelineOutput setNullValuePolicy(CSVWriter.ValuePolicy nullValuePolicy)
      Sets how null values are written (defaults to CSVWriter.ValuePolicy.EMPTY_STRING, an unquoted blank).
    • getEmptyStringValuePolicy

      public CSVWriter.ValuePolicy getEmptyStringValuePolicy()
      Returns how empty strings are written (defaults to CSVWriter.ValuePolicy.QUOTED_EMPTY_STRING, a pair of quotes).
    • setEmptyStringValuePolicy

      public CsvPipelineOutput setEmptyStringValuePolicy(CSVWriter.ValuePolicy emptyStringValuePolicy)
      Sets how empty strings are written (defaults to CSVWriter.ValuePolicy.QUOTED_EMPTY_STRING, a pair of quotes).
    • isForceQuote

      public boolean isForceQuote()
      Indicates if every non-empty value is quoted, not only those that need it (defaults to false).
    • setForceQuote

      public CsvPipelineOutput setForceQuote(boolean forceQuote)
      Indicates if every non-empty value is quoted, not only those that need it (defaults to false).
    • isAutoCloseWriter

      public boolean isAutoCloseWriter()
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • setAutoCloseWriter

      public CsvPipelineOutput setAutoCloseWriter(boolean autoCloseWriter)
      Indicates if the file's stream is closed when the writer is closed (defaults to true).
    • isFlushOnWrite

      public boolean isFlushOnWrite()
      Indicates if the output is flushed after each record (defaults to false).
    • setFlushOnWrite

      public CsvPipelineOutput setFlushOnWrite(boolean flushOnWrite)
      Indicates if the output is flushed after each record (defaults to false).
    • isFieldNamesInFirstRow

      public boolean isFieldNamesInFirstRow()
      Indicates if a header row of field names is written first (defaults to true).
    • setFieldNamesInFirstRow

      public CsvPipelineOutput setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
      Indicates if a header row of field names is written first (defaults to true).
    • createDataWriter

      public DataWriter createDataWriter()
    • getFileSink

      public FileSink getFileSink()
      Specified by:
      getFileSink in class FileSinkPipelineOutput
    • setFileSink

      public CsvPipelineOutput setFileSink(FileSink fileSink)
      Specified by:
      setFileSink in class FileSinkPipelineOutput
    • generateSaveCode

      public void generateSaveCode(JavaCodeBuilder javaCodeBuilder)
      Description copied from class: FileSinkPipelineOutput
      Writes the generated code that saves the output after Job.run(reader, writer); does nothing by default.
      Overrides:
      generateSaveCode in class FileSinkPipelineOutput
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • getCharset

      public String getCharset()
      Returns the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • setCharset

      public CsvPipelineOutput setCharset(String charset)
      Sets the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineOutput
    • fromXmlElement

      public CsvPipelineOutput fromXmlElement(Element pipelineOutputElement)