Package com.logicaldoc.util.csv
Class CSVFileWriter
java.lang.Object
com.logicaldoc.util.csv.CSVFile
com.logicaldoc.util.csv.CSVFileWriter
- All Implemented Interfaces:
Closeable
,AutoCloseable
CSVFileWriter is a class derived from CSVFile used to format some fields into
a new CSV file.
- Version:
- %I%, %G%
- Author:
- Fabrizio Fazzino
-
Constructor Summary
ConstructorDescriptionCSVFileWriter
(String outputFileName) CSVFileWriter constructor just need the name of the CSV file that will be written.CSVFileWriter
(String outputFileName, boolean append) CSVFileWriter constructor just need the name of the CSV file that will be written.CSVFileWriter
(String outputFileName, char sep) CSVFileWriter constructor with a given field separator.CSVFileWriter
(String outputFileName, char sep, boolean append) CSVFileWriter constructor with a given field separator.CSVFileWriter
(String outputFileName, char sep, char qual) CSVFileWriter constructor with given field separator and text qualifier.CSVFileWriter
(String outputFileName, char sep, char qual, boolean append) CSVFileWriter constructor with given field separator and text qualifier. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the output CSV file.void
writeFields
(List<String> fields) Join the fields and write them as a new line to the CSV file.Methods inherited from class com.logicaldoc.util.csv.CSVFile
getFieldSeparator, getTextQualifier, setFieldSeparator, setTextQualifier
-
Constructor Details
-
CSVFileWriter
CSVFileWriter constructor just need the name of the CSV file that will be written.- Parameters:
outputFileName
- The name of the CSV file to be opened for writing- Throws:
IOException
- If an error occurs while creating the file
-
CSVFileWriter
CSVFileWriter constructor with a given field separator.- Parameters:
outputFileName
- The name of the CSV file to be opened for readingsep
- The field separator to be used; overwrites the default one- Throws:
IOException
- If an error occurs while creating the file
-
CSVFileWriter
CSVFileWriter constructor with given field separator and text qualifier.- Parameters:
outputFileName
- The name of the CSV file to be opened for readingsep
- The field separator to be used; overwrites the default onequal
- The text qualifier to be used; overwrites the default one- Throws:
IOException
- If an error occurs while creating the file
-
CSVFileWriter
CSVFileWriter constructor just need the name of the CSV file that will be written.- Parameters:
outputFileName
- The name of the CSV file to be opened for writingappend
- True if rows must be appended- Throws:
IOException
- If an error occurs while creating the file
-
CSVFileWriter
CSVFileWriter constructor with a given field separator.- Parameters:
outputFileName
- The name of the CSV file to be opened for readingsep
- The field separator to be used; overwrites the default oneappend
- True if rows must be appended- Throws:
IOException
- If an error occurs while creating the file
-
CSVFileWriter
CSVFileWriter constructor with given field separator and text qualifier.- Parameters:
outputFileName
- The name of the CSV file to be opened for readingsep
- The field separator to be used; overwrites the default onequal
- The text qualifier to be used; overwrites the default oneappend
- True if rows must be appended- Throws:
IOException
- If an error occurs while creating the file
-
-
Method Details
-
close
Close the output CSV file.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- If an error occurs while closing the file
-
writeFields
Join the fields and write them as a new line to the CSV file.- Parameters:
fields
- The vector of strings containing the fields
-