Class FixedWidthPipelineOutput

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

public class FixedWidthPipelineOutput extends FileSinkPipelineOutput
Writes a pipeline's records to a fixed-width text FileSink using a FixedWidthWriter.
See Also:
  • Constructor Details

    • FixedWidthPipelineOutput

      public FixedWidthPipelineOutput()
  • 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
    • getFileSink

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

      public FixedWidthPipelineOutput setFileSink(FileSink fileSink)
      Specified by:
      setFileSink in class FileSinkPipelineOutput
    • getFields

      public List<FixedWidthField> getFields()
    • setFields

      public FixedWidthPipelineOutput setFields(List<FixedWidthField> fields)
    • addField

      public FixedWidthPipelineOutput addField(FixedWidthField field)
    • addFields

      public FixedWidthPipelineOutput addFields(int... width)
      Appends left-aligned columns of the given widths that use the output's fill character.
    • addField

      public FixedWidthPipelineOutput addField(String name, int width)
      Appends a left-aligned column that uses the output's fill character. Each record must have one field per column, matched by position.
    • addField

      public FixedWidthPipelineOutput addField(String name, int width, FixedWidthAlign align, Character fillChar)
      Appends a column with its own alignment and fill character (null uses the output's). Each record must have one field per column, matched by position.
    • skipField

      public FixedWidthPipelineOutput skipField(int width)
    • getFillChar

      public char getFillChar()
      Returns the character used to pad values in columns without their own fill character (defaults to space).
    • setFillChar

      public FixedWidthPipelineOutput setFillChar(char fillChar)
      Sets the character used to pad values in columns without their own fill character (defaults to space).
    • isTruncateFields

      public boolean isTruncateFields()
      Indicates if values longer than their column are cut to fit instead of failing the write (defaults to true).
    • setTruncateFields

      public FixedWidthPipelineOutput setTruncateFields(boolean truncateFields)
      Indicates if values longer than their column are cut to fit instead of failing the write (defaults to true).
    • getNewLine

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

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

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

      public FixedWidthPipelineOutput 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 FixedWidthPipelineOutput 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 FixedWidthPipelineOutput setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
      Indicates if a header row of field names is written first (defaults to true).
    • createDataWriter

      public DataWriter createDataWriter()
    • 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 FixedWidthPipelineOutput setCharset(String charset)
      Sets the character set used to write the file (defaults to UTF-8); blank uses the platform default.
    • 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 FixedWidthPipelineOutput 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.
    • 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 FixedWidthPipelineOutput fromXmlElement(Element pipelineInputElement)