Package org.supercsv.encoder
Interface CsvEncoder
- All Known Implementing Classes:
DefaultCsvEncoder
,SelectiveCsvEncoder
public interface CsvEncoder
Defines the interface for all CSV encoders.
- Since:
- 2.1.0
-
Method Summary
Modifier and TypeMethodDescriptionencode
(String input, CsvContext context, CsvPreference preference) Encodes a String to be written to a CSV file.
-
Method Details
-
encode
Encodes a String to be written to a CSV file. The encoder should honour all CSV preferences including updating the current lineNumber (in the CSV context - it will be updated in the calling CsvWriter after encoding has completed) as line terminators are encountered in the String to be escaped (converting all 3 variations of line terminators to the end of line symbols specified in the preferences). The CsvContext can also be used to encode based on the current context (e.g. you may want to always put quotes around a particular column).- Parameters:
input
- the String to be encodedcontext
- the contextpreference
- the CSV preferences- Returns:
- the encoded CSV
-