Interface ICsvWriter

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int getLineNumber()
      Gets the current position in the file.
      int getRowNumber()
      Gets the current row number (i.e.
      void writeComment​(java.lang.String comment)
      Writes a single-line comment to the CSV file (the comment must already include any special comment characters e.g.
      void writeHeader​(java.lang.String... header)
      Writes the header of the CSV file.
      • Methods inherited from interface java.io.Closeable

        close
      • Methods inherited from interface java.io.Flushable

        flush
    • Method Detail

      • getLineNumber

        int getLineNumber()
        Gets the current position in the file. The first line of the file is line number 1.
        Returns:
        the line number
        Since:
        1.0
      • getRowNumber

        int getRowNumber()
        Gets the current row number (i.e. the number of CSV records - including the header - that have been written). This differs from the lineNumber, which is the number of real lines that have been written to the file. The first row is row 1 (which is typically the header row).
        Returns:
        the current row number
        Since:
        2.0.0
      • writeComment

        void writeComment​(java.lang.String comment)
                   throws java.io.IOException
        Writes a single-line comment to the CSV file (the comment must already include any special comment characters e.g. '#' at start). Please note that comments are not part of RFC4180, so this may make your CSV file less portable.
        Parameters:
        comment - the comment
        Throws:
        java.lang.NullPointerException - if comment is null
        java.io.IOException - if an I/O error occurs
        Since:
        2.1.0
      • writeHeader

        void writeHeader​(java.lang.String... header)
                  throws java.io.IOException
        Writes the header of the CSV file.
        Parameters:
        header - one or more header Strings
        Throws:
        java.lang.NullPointerException - if header is null
        java.io.IOException - if an I/O error occurs
        Since:
        1.0