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
public class CSVFileWriter extends CSVFile implements Closeable
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
Constructors Constructor Description CSVFileWriter(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the output CSV file.void
writeFields(Vector<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 Detail
-
CSVFileWriter
public CSVFileWriter(String outputFileName) throws IOException
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
public CSVFileWriter(String outputFileName, char sep) throws IOException
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
public CSVFileWriter(String outputFileName, char sep, char qual) throws IOException
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
public CSVFileWriter(String outputFileName, boolean append) throws IOException
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
public CSVFileWriter(String outputFileName, char sep, boolean append) throws IOException
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
public CSVFileWriter(String outputFileName, char sep, char qual, boolean append) throws IOException
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 Detail
-
close
public void close() throws IOException
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
-
-