Interface ICsvWriter
- All Superinterfaces:
AutoCloseable, Closeable, Flushable
- All Known Subinterfaces:
ICsvBeanWriter, ICsvListWriter, ICsvMapWriter, ICsvResultSetWriter
- All Known Implementing Classes:
AbstractCsvWriter, CsvBeanWriter, CsvListWriter, CsvMapWriter, CsvResultSetWriter
-
Method Summary
Modifier and TypeMethodDescriptionintGets the current position in the file.intGets the current row number (i.e.voidwriteComment(String comment) Writes a single-line comment to the CSV file (the comment must already include any special comment characters e.g.voidwriteHeader(String... header) Writes the header of the CSV file.
-
Method Details
-
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
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:
NullPointerException- if comment is nullIOException- if an I/O error occurs- Since:
- 2.1.0
-
writeHeader
Writes the header of the CSV file.- Parameters:
header- one or more header Strings- Throws:
NullPointerException- if header is nullIOException- if an I/O error occurs- Since:
- 1.0
-