/** * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using a Writer to write data to. * * @param outputStream The stream to write the column delimited data to. * @param delimiter The character to use as the column delimiter. */ public CsvWriter(Writer outputStream, char delimiter) { if (outputStream == null) { throw new IllegalArgumentException("Parameter outputStream can not be null."); } this.outputStream = outputStream; userSettings.Delimiter = delimiter; initialized = true; }
/** * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using a file as the data * destination. * * @param fileName The path to the file to output the data. * @param delimiter The character to use as the column delimiter. * @param charset The {@link java.nio.charset.Charset Charset} to use while writing the data. */ public CsvWriter(String fileName, char delimiter, Charset charset) { if (fileName == null) { throw new IllegalArgumentException("Parameter fileName can not be null."); } if (charset == null) { throw new IllegalArgumentException("Parameter charset can not be null."); } this.fileName = fileName; userSettings.Delimiter = delimiter; this.charset = charset; }
/** * Sets the character to use as the column delimiter. * * @param delimiter The character to use as the column delimiter. */ public void setDelimiter(char delimiter) { userSettings.Delimiter = delimiter; }