Package nl.colorize.util.stats
Class CSVFormat
java.lang.Object
nl.colorize.util.stats.CSVFormat
Describes the format of a CSV file, which is necessary since the CSV file
format is not fully standardized. Instances of the format can then be used
to parse CSV files into
CSVRecord
s, or to serialize records into
CSV files.
Note: This class is intended for basic CSV support. When working with CSV files produced by other applications, prefer using the FastCSV library.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionParses the specified CSV file using thisCSVFormat
, and returns the resulting records.Serializes the specified record using this CSV format.Serializes the specified record using this CSV format.Serializes the specified record using this CSV format.static CSVFormat
withHeaders
(char delimiter) withLineSeparator
(String lineSeparator) static CSVFormat
withoutHeaders
(char delimiter)
-
Field Details
-
COMMA
-
TAB
-
SEMICOLON
-
-
Method Details
-
withQuotes
-
withLineSeparator
-
parseCSV
Parses the specified CSV file using thisCSVFormat
, and returns the resulting records. If this CSV format includes header information, the first record in the file is assumed to contain the headers. -
toCSV
Serializes the specified record using this CSV format. The serialized line will end with a trailing line separator. This method can be used for both rows and headers, since CSV files do not differentiate between the two apart from their location within the file.- Throws:
IllegalArgumentException
- if the record does not contain at least one cell.
-
toCSV
Serializes the specified record using this CSV format. The serialized line will end with a trailing line separator. This method can be used for both rows and headers, since CSV files do not differentiate between the two apart from their location within the file.- Throws:
IllegalArgumentException
- if the record does not contain at least one cell.
-
toCSV
Serializes the specified record using this CSV format. The serialized line will end with a trailing line separator.- Throws:
IllegalArgumentException
- if the record does not contain at least one cell.
-
withHeaders
-
withoutHeaders
-