Class CsvOutput.CsvRowOutputWithHeaders

  • Enclosing class:
    CsvOutput

    public class CsvOutput.CsvRowOutputWithHeaders
    extends Object
    Class used when outputting CSV with headers.
    • Method Detail

      • writeCells

        public CsvOutput.CsvRowOutputWithHeaders writeCells​(Map<String,​String> valueMap)
        Writes a map of cells to the output, with the cell only being output when writeNewLine() is called.

        The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.

        This method is equivalent to multiple calls to writeCell(String, String).

        Note that if writeNewLine() is not called, the cell will never be output.

        Parameters:
        valueMap - the map of values to write keyed by header
        Returns:
        this, for method chaining
        Throws:
        IllegalArgumentException - if one of the headers does not match
        UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(String header,
                                                           String value)
        Writes a single cell by header, with the cell only being output when writeNewLine() is called.

        The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.

        Note that if writeNewLine() is not called, the cell will never be output.

        Parameters:
        header - the header to write
        value - the value to write
        Returns:
        this, for method chaining
        Throws:
        IllegalArgumentException - if one of the headers does not match
        UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(String header,
                                                           Object value)
        Writes a single cell by header, with the cell only being output when writeNewLine() is called.

        The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.

        Note that if writeNewLine() is not called, the cell will never be output.

        Parameters:
        header - the header to write
        value - the value to write
        Returns:
        this, for method chaining
        Throws:
        IllegalArgumentException - if one of the headers does not match
        UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(String header,
                                                           double value)
        Writes a single cell by header, with the cell only being output when writeNewLine() is called.

        The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.

        Note that if writeNewLine() is not called, the cell will never be output.

        Parameters:
        header - the header to write
        value - the value to write
        Returns:
        this, for method chaining
        Throws:
        IllegalArgumentException - if one of the headers does not match
        UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(String header,
                                                           long value)
        Writes a single cell by header, with the cell only being output when writeNewLine() is called.

        The header must exactly match the header passed into the constructor of this instance. An exception is thrown if the header is not known.

        Note that if writeNewLine() is not called, the cell will never be output.

        Parameters:
        header - the header to write
        value - the value to write
        Returns:
        this, for method chaining
        Throws:
        IllegalArgumentException - if one of the headers does not match
        UncheckedIOException - if an IO exception occurs