Class CsvOutput.CsvRowOutputWithHeaders

  • Enclosing class:
    CsvOutput

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

      • writeLine

        public CsvOutput.CsvRowOutputWithHeaders writeLine​(java.util.Map<java.lang.String,​java.lang.String> valueMap)
        Writes a row to the output, specifying each value by the header.

        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) followed by one call to writeNewLine().

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

        public CsvOutput.CsvRowOutputWithHeaders writeCells​(java.util.Map<java.lang.String,​java.lang.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:
        java.lang.IllegalArgumentException - if one of the headers does not match
        java.io.UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(java.lang.String header,
                                                           java.lang.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:
        java.lang.IllegalArgumentException - if one of the headers does not match
        java.io.UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(java.lang.String header,
                                                           java.lang.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:
        java.lang.IllegalArgumentException - if one of the headers does not match
        java.io.UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(java.lang.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:
        java.lang.IllegalArgumentException - if one of the headers does not match
        java.io.UncheckedIOException - if an IO exception occurs
      • writeCell

        public CsvOutput.CsvRowOutputWithHeaders writeCell​(java.lang.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:
        java.lang.IllegalArgumentException - if one of the headers does not match
        java.io.UncheckedIOException - if an IO exception occurs
      • writeNewLine

        public CsvOutput.CsvRowOutputWithHeaders writeNewLine()
        Writes a new line character.
        Returns:
        this, for method chaining
        Throws:
        java.io.UncheckedIOException - if an IO exception occurs