CsvWriter

CsvWriter CsvWriter ( String filePath ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, boolean addTimeStamp ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator, boolean addTimeStamp ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator, char quotechar ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator, char quotechar, char escapechar ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator, char quotechar, String lineEnd ) (professional and enterprise editions only)
CsvWriter CsvWriter ( String filePath, char separator, char quotechar, char escapechar, String lineEnd ) (professional and enterprise editions only)

Description

Create a csv file writer.

Parameters

  • filePath File path to where the csv file should be created/saved, as a string.
  • addTimeStamp (optional) If true a time stamp will be added to the filename; otherwise, the filePath will remain unchanged.
  • seperator (optional) The character that should be used to separate the fields in the csv file, the default is char 44 (comma).
  • quotechar (optional) The character that should be used to quote fields, the default is char 34 (straight double-quotes).
  • escapechar (optional) The escape character for quotes, the default is char 34 (straight double-quotes).
  • lineEnd (optional) The end of line character, as a string. The default is the new line character ("\n").

Return Values

Returns a CsvWriter object. If it encounters an error it will be thrown.

Change Log

Version Description
5.0 Available for Professional and Enterprise editions.
4.5.18a Introduced in alpha version.

Class Location

com.screenscraper.csv.CsvWriter

Examples

Create CsvWriter

 // Import class
 import com.screenscraper.csv.*;

 // Create CsvWriter with timestamp
 CsvWriter writer = new CsvWriter("output.csv", true);

 // Save in session variable for general access
 session.setVariable( "WRITER", writer);