Java Code Examples for com.csvreader.CsvWriter

The following are top voted examples for showing how to use com.csvreader.CsvWriter. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenDiabetes   File: AllTests.java   Source Code and License 9 votes vote down vote up
@Test
public void test57() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, '\t', Charset
			.forName("ISO-8859-1"));
	Assert.assertTrue(writer.getUseTextQualifier());
	writer.setUseTextQualifier(false);
	Assert.assertFalse(writer.getUseTextQualifier());
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("1,2\t3\tblah \"some stuff in quotes\"\r\n", data);
}
 
Example 2
Project: OpenDiabetes   File: AllTests.java   Source Code and License 7 votes vote down vote up
@Test
public void test55() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("");
	writer.write("1");
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"\",1", data);
}
 
Example 3
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test56() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, '\t', Charset
			.forName("ISO-8859-1"));
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals(
			"1,2\t3\t\"blah \"\"some stuff in quotes\"\"\"\r\n", data);
}
 
Example 4
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test58() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, '\t', Charset
			.forName("ISO-8859-1"));
	writer.write("data\r\nmore data");
	writer.write(" 3\t", false);
	writer.write(" 3\t");
	writer.write(" 3\t", true);
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"data\r\nmore data\"\t3\t3\t\" 3\t\"\r\n", data);
}
 
Example 5
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test71() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.setForceQualifier(true);
	writer.write(" data ");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"data\"\r\n", data);
}
 
Example 6
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test72() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	Assert.assertEquals('\0', writer.getRecordDelimiter());
	writer.setRecordDelimiter(';');
	Assert.assertEquals(';', writer.getRecordDelimiter());
	writer.write("a;b");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"a;b\";", data);
}
 
Example 7
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test74() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);
	writer.setUseTextQualifier(false);
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();
	Assert.assertEquals("1\\,2,3,blah \"some stuff in quotes\"\r\n", data);
}
 
Example 8
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test75() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("1");
	writer.endRecord();
	writer.writeComment("blah");
	writer.write("2");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();
	Assert.assertEquals("1\r\n#blah\r\n2\r\n", data);
}
 
Example 9
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test87() throws Exception {
	CsvWriter writer = new CsvWriter("temp.csv");
	writer.write("1");
	writer.close();

	CsvReader reader = new CsvReader("temp.csv");
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("1", reader.get(0));
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals(0L, reader.getCurrentRecord());
	Assert.assertFalse(reader.readRecord());
	reader.close();

	new File("temp.csv").delete();
}
 
Example 10
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test120() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("1,2");
	writer.endRecord();

	buffer = stream.toByteArray();
	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();
	Assert.assertEquals("", data);

	writer.flush(); // testing that flush flushed to stream

	buffer = stream.toByteArray();
	stream.close();
	data = Charset.forName("ISO-8859-1").decode(ByteBuffer.wrap(buffer))
			.toString();
	Assert.assertEquals("\"1,2\"\r\n", data);
	writer.close();
}
 
Example 11
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test121() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.writeRecord(new String[] { " 1 ", "2" }, false);
	writer.writeRecord(new String[] { " 1 ", "2" });
	writer.writeRecord(new String[] { " 1 ", "2" }, true);
	writer.writeRecord(new String[0], true);
	writer.writeRecord(null, true);
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();
	Assert.assertEquals("1,2\r\n1,2\r\n\" 1 \",2\r\n", data);
}
 
Example 12
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test122() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("1,2");
	writer.write(null);
	writer.write("3 ", true);
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"1,2\",,\"3 \"\r\n", data);
}
 
Example 13
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test124() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.setRecordDelimiter(';');
	writer.setUseTextQualifier(false);
	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);

	writer.write("1;2");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("1\\;2;", data);
}
 
Example 14
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void test132() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);

	writer.write("1,\\2");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"1,\\\\2\"\r\n", data);
}
 
Example 15
Project: OpenDiabetes   File: AllTests.java   Source Code and License 6 votes vote down vote up
@Test
public void Test174() throws IOException {
	// verifies that data is eventually automatically flushed
	CsvWriter writer = new CsvWriter("temp.csv");
	
	for (int i = 0; i < 10000; i++)
	{
		writer.write("stuff");
		writer.endRecord();
	}
	
	CsvReader reader = new CsvReader("temp.csv");
	
	Assert.assertTrue(reader.readRecord());
	
	Assert.assertEquals("stuff", reader.get(0));
	
	writer.close();
	reader.close();

	new File("temp.csv").delete();
}
 
Example 16
Project: caom2db   File: GetAction.java   Source Code and License 6 votes vote down vote up
protected long writeObservationList(List<ObservationState> states) throws IOException {
    DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC);
    syncOutput.setHeader("Content-Type", "text/tab-separated-values");
    
    OutputStream os = syncOutput.getOutputStream();
    ByteCountOutputStream bc = new ByteCountOutputStream(os);
    OutputStreamWriter out = new OutputStreamWriter(bc, "US-ASCII");
    CsvWriter writer = new CsvWriter(out, '\t');
    for (ObservationState state : states) {
        writer.write(state.getURI().getCollection());
        writer.write(state.getURI().getObservationID());
        if (state.maxLastModified != null) {
            writer.write(df.format(state.maxLastModified));
        } else {
            writer.write("");
        }
        if (state.accMetaChecksum != null) {
            writer.write(state.accMetaChecksum.toASCIIString());
        } else {
            writer.write("");
        }
        writer.endRecord();
    }
    writer.flush();
    return bc.getByteCount();
}
 
Example 17
Project: caom2db   File: GetDeletedAction.java   Source Code and License 6 votes vote down vote up
private long writeDeleted(List<DeletedObservation> dels) throws IOException {
    DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC);
    syncOutput.setHeader("Content-Type", "text/tab-separated-values");
    
    OutputStream os = syncOutput.getOutputStream();
    ByteCountOutputStream bc = new ByteCountOutputStream(os);
    OutputStreamWriter out = new OutputStreamWriter(bc, "US-ASCII");
    CsvWriter writer = new CsvWriter(out, '\t');
    for (DeletedObservation ddo : dels) {
        writer.write(ddo.getID().toString());
        writer.write(ddo.getURI().getCollection());
        writer.write(ddo.getURI().getObservationID());
        if (ddo.getLastModified() != null) {
            writer.write(df.format(ddo.getLastModified()));
        } else {
            writer.write("");
        }
        writer.endRecord();
    }
    writer.flush();
    return bc.getByteCount();
}
 
Example 18
Project: caom2db   File: GetAction22.java   Source Code and License 6 votes vote down vote up
@Override
protected long writeObservationList(List<ObservationState> states) throws IOException {
    DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC);
    syncOutput.setHeader("Content-Type", "text/csv");
    
    OutputStream os = syncOutput.getOutputStream();
    ByteCountOutputStream bc = new ByteCountOutputStream(os);
    CsvWriter writer = new CsvWriter(bc, ',', Charset.defaultCharset());
    for (ObservationState state : states) {
        writer.write(state.getURI().getObservationID());
        writer.write(df.format(state.maxLastModified));
        writer.endRecord();
    }
    writer.flush();
    return bc.getByteCount();
}
 
Example 19
Project: caom2db   File: RepoAction.java   Source Code and License 6 votes vote down vote up
protected void doGetCollectionList() throws Exception {
    log.debug("START: (collection list)");
    CaomRepoConfig curConfig = getConfig();
    Iterator<String> collectionListIterator = curConfig.collectionIterator();
    syncOutput.setHeader("Content-Type", "text/tab-separated-values");
    
    OutputStream os = syncOutput.getOutputStream();
    ByteCountOutputStream bc = new ByteCountOutputStream(os);
    OutputStreamWriter out = new OutputStreamWriter(bc, "US-ASCII");
    CsvWriter writer = new CsvWriter(out, '\t');
    while (collectionListIterator.hasNext()) {
        String collectionName = collectionListIterator.next();
        // Write out a single column as one entry per row
        if (!collectionName.isEmpty()) {
            writer.write(collectionName);
            writer.endRecord();
        }
    }
    writer.flush();
    logInfo.setBytes(bc.getByteCount());
}
 
Example 20
Project: jisql   File: CSVFormatter.java   Source Code and License 6 votes vote down vote up
/**
 * Called to output the data.  This class uses a third party library to output
 * the CSV data.  The library escapes the data as needed.
 *
 * @param out the PrintStream to output data to.
 * @param resultSet the ResultSet for the row.
 * @param metaData the ResultSetMetaData for the row.
 *
 *
 */
public void formatData( PrintStream out, ResultSet resultSet, ResultSetMetaData metaData ) throws Exception {
	
	CsvWriter csvWriter = new CsvWriter( out, delimiter, Charset.forName( "us-ascii" )  );
	
    while( resultSet.next() ) {
        int numColumns = metaData.getColumnCount();

        for (int i = 1; i <= numColumns; i++) {
        	String result = resultSet.getString(i);
        	if( !resultSet.wasNull() )
        		csvWriter.write( result );
        	else
        		csvWriter.write( "" );
        }
        
        csvWriter.endRecord();
    }
    
    csvWriter.flush();
}
 
Example 21
Project: components   File: S3OutputWriter.java   Source Code and License 6 votes vote down vote up
@Override
public void open(String uId) throws IOException {
    // connect to s3
    s3_client = S3Connection.createClient(properties);
    try {
        s3_client.listObjects(properties.getDatasetProperties().bucket.getValue(), "any");
    } catch (AmazonServiceException ase) {
        if (ase.getStatusCode() != Constants.NO_SUCH_BUCKET_STATUS_CODE) {
            throw ase;
        }
    }

    // prepare the local target, will upload it to s3 and clear it in the close method
    data_file = File.createTempFile("s3-", ".csv");

    OutputStream outputStream = new FileOutputStream(data_file);
    writer = new CsvWriter(new OutputStreamWriter(outputStream), ';');
}
 
Example 22
Project: motherbrain   File: LocalBufferProducer.java   Source Code and License 6 votes vote down vote up
public LocalBufferProducer(SinkToBuffer operation) throws OperationException {
  _operation = operation;
  if(Universe.instance().env().isLocal()) {
    String outputFile = Universe.instance().config().getOrException("output.prefix");
    if(!outputFile.equals("")) {
      outputFile += "_"+_operation.getTopicName()+".csv";
      try {
        String outputFilePath = Universe.instance().config().getOrException("directory")+"/"+outputFile;
        _operation.logger().writeLog("Writing output for relation ["+_operation.getTopicName()+"] to file: "+outputFilePath, OperationLogger.LogPriority.RUN);
        _csvOutput = new CsvWriter(new FileWriter(outputFilePath), ',');
      } catch (IOException e) {
        throw (OperationException) new OperationException(_operation, e).setUserMessage("Could not open CSV file for writing.").adviseRetry();
      }
    }
  }
}
 
Example 23
Project: HanziHelper   File: RecordExport.java   Source Code and License 6 votes vote down vote up
private static void delimitedExport(CharRecord rec, String filename, char delimiter) throws IOException {
    Collection c = rec.getRecords(false);
    CsvWriter csvOutput = new CsvWriter(filename, delimiter, Charset.forName("UTF-8"));
    for (Iterator iterator = c.iterator(); iterator.hasNext();) {
        Record record = (Record) iterator.next();
        csvOutput.write(record.getPinyin());
        csvOutput.write(record.getChars());
        csvOutput.write(record.getTrad());
        csvOutput.write(record.getEnglish());
        csvOutput.write(record.getBook());
        csvOutput.write(record.getChapter());
        csvOutput.endRecord();
    }
    csvOutput.close();

}
 
Example 24
Project: BARMAS   File: DatasetBuilder.java   Source Code and License 6 votes vote down vote up
/**
 * @param string
 * @param header
 * @return
 */
private void createCSVFile(File file, List<String> header) {
	try {
		CsvWriter csv = new CsvWriter(new FileWriter(file), ',');

		String[] finalHeaders = new String[header.size()];
		int pos = 0;
		for (String column : header) {
			finalHeaders[pos++] = column;
		}
		csv.writeRecord(finalHeaders);
		csv.close();

	} catch (IOException e) {
		logger.severe(e.getMessage());
		System.exit(1);
	}
}
 
Example 25
Project: BARMAS   File: ExperimentsAnalyser.java   Source Code and License 6 votes vote down vote up
/**
 * @param writer
 * @param columns
 * @throws IOException
 */
private void writeAnalysisForConfigurationParams(CsvWriter writer, int columns)
		throws IOException {
	String name = "TTH-DTH-BTH";
	for (int tth = 0; tth < tths.size(); tth++) {
		for (int dth = 0; dth < dths.size(); dth++) {
			for (int bth = 0; bth < bths.size(); bth++) {
				String[] row = new String[columns];
				row[0] = name;
				row[1] = this.getStringForPosInTheMatrix(tths, tth) + "-"
						+ this.getStringForPosInTheMatrix(dths, dth) + "-"
						+ this.getStringForPosInTheMatrix(bths, bth);
				row[2] = this.getAvgImpValueForConfigurationsParams(tth, dth, bth);
				writer.writeRecord(row);
			}
		}
	}
}
 
Example 26
Project: caarray   File: CaArrayUtils.java   Source Code and License 6 votes vote down vote up
/**
 * Joins the given values as a comma-separated string. Each value will be encoded in this string by escaping any
 * commas in the value with a backslash.
 * 
 * @param values the values to join (null is acceptable).
 * @return the CSV string consisting of the values. If the values were null, an empty String.
 */
public static String joinAsCsv(String[] values) {
    if (values == null) {
        return StringUtils.EMPTY;
    }
    try {
        final StringWriter sw = new StringWriter();
        final CsvWriter csvWriter = new CsvWriter(sw, ',');
        csvWriter.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);
        csvWriter.setUseTextQualifier(false);
        csvWriter.writeRecord(values);
        csvWriter.flush();
        csvWriter.close();
        return sw.toString();
    } catch (final IOException e) {
        throw new IllegalStateException("Could not encode as CSV record: " + e, e);
    }
}
 
Example 27
Project: CrowdBenchmark   File: MyCsvWriter.java   Source Code and License 6 votes vote down vote up
public void WriteToFile(List<Data> input, String path){
	try {
		CsvWriter csvOutput = new CsvWriter(new FileWriter("test", false), ',');
		int size = input.size();
		int start = 0;
		for (; start < size; start++) {
			Data onerow = input.get(start);
			String[] content = onerow.toString().split("\t");
			for (String piece : content) {
				csvOutput.write(piece);
			}
			csvOutput.endRecord();
		}
		csvOutput.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 28
Project: CrowdBenchmark   File: MyCsvWriter.java   Source Code and License 6 votes vote down vote up
private void saveRawFile(String outputFile, String[] lines,
		boolean withTitle) {
	boolean alreadyExists = new File(outputFile).exists();
	try {
		CsvWriter csvOutput = new CsvWriter(
				new FileWriter(outputFile, true), ',');
		int size = lines.length;
		int start = 0;
		if (!withTitle)
			start = 1;
		if (alreadyExists) {
			start = 1;
		}
		for (; start < size; start++) {
			String line = lines[start];
			csvOutput.write(line);
			csvOutput.endRecord();
		}
		csvOutput.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 29
Project: CrowdBenchmark   File: My_CsvWriter.java   Source Code and License 6 votes vote down vote up
private void saveRawFile(String outputFile, String[] lines,
		boolean withTitle) {
	boolean alreadyExists = new File(outputFile).exists();
	try {
		CsvWriter csvOutput = new CsvWriter(
				new FileWriter(outputFile, true), ',');
		int size = lines.length;
		int start = 0;
		if (!withTitle)
			start = 1;
		if (alreadyExists) {
			start = 1;
		}
		for (; start < size; start++) {
			String line = lines[start];
			csvOutput.write(line);
			csvOutput.endRecord();
		}
		csvOutput.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 30
Project: alfresco-audit-share   File: AuditExportGet.java   Source Code and License 6 votes vote down vote up
/**
 * 
 * @param csv
 *            CsvWriter object used to write results
 * @param auditCounts
 *            Audit results
 * @param date
 *            Date
 * @param actions
 * @throws IOException
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public void writeAuditCount(CsvWriter csv, List<AuditCount> auditCounts, String date, Map<String, Integer> actions) throws IOException {

	for (AuditCount auditCount : auditCounts) {
		actions.put(auditCount.getTarget(), auditCount.getCount());
	}

	Iterator i = actions.entrySet().iterator();
	while (i.hasNext()) {
		Map.Entry<String, Integer> e = (Map.Entry<String, Integer>) i.next();
		String[] record = new String[3];

		record[0] = date;
		record[1] = I18NUtil.getMessage("csv." + (String) e.getKey());
		record[2] = ((Integer) e.getValue()).toString();
		csv.writeRecord(record);
		e.setValue(new Integer(0));
	}

}
 
Example 31
Project: alfresco-audit-share   File: AuditExportGet.java   Source Code and License 6 votes vote down vote up
public void writeCsvEntry(CsvWriter csv, List<CsvExportEntry> csvExportEntries, boolean dateFirst, String date) throws IOException {
	for (CsvExportEntry csvExportEntry : csvExportEntries) {
		String[] record;
		int recordIndex = 0;
		if (date != null) {
			record = new String[5];
			if (dateFirst) {
				record[recordIndex++] = date;
			}
		} else {
			record = new String[4];
		}
		record[recordIndex++] = csvExportEntry.getAuditSite();
		record[recordIndex++] = I18NUtil.getMessage("csv." + csvExportEntry.getAuditAppName());
		record[recordIndex++] = I18NUtil.getMessage("csv." + csvExportEntry.getAuditAppName() + "."
				+ csvExportEntry.getAuditActionName());
		record[recordIndex++] = String.valueOf(csvExportEntry.getCount());

		if (!dateFirst && date != null) {
			record[recordIndex++] = date;
		}
		csv.writeRecord(record);
	}
}
 
Example 32
Project: OpenDiabetes   File: CsvFileExporter.java   Source Code and License 5 votes vote down vote up
protected void writeToFile(List<ExportEntry> csvEntries) throws IOException {
    CsvWriter cwriter = new CsvWriter(fileOutpuStream, VaultCsvEntry.CSV_DELIMITER,
            Charset.forName("UTF-8"));

    cwriter.writeRecord(((CsvEntry) csvEntries.get(0)).getCsvHeaderRecord());
    for (ExportEntry item : csvEntries) {
        cwriter.writeRecord(((CsvEntry) item).toCsvRecord());
    }
    cwriter.flush();
    cwriter.close();
}
 
Example 33
Project: OpenDiabetes   File: VaultOdvExporter.java   Source Code and License 5 votes vote down vote up
@Override
protected void writeToFile(List<ExportEntry> csvEntries) throws IOException {
    // Setup compression stuff
    ZipOutputStream zos = new ZipOutputStream(fileOutpuStream);
    zos.setMethod(ZipOutputStream.DEFLATED);
    zos.setLevel(9);

    // Setup signature stuff
    MessageDigest md;
    try {
        md = MessageDigest.getInstance("SHA-512");
    } catch (NoSuchAlgorithmException ex) {
        LOG.log(Level.SEVERE, "Missing hash algorithm for signature. No file exported!", ex);
        throw new IOException("Missing hash algorithm for signature.");
    }
    DigestOutputStream dos = new DigestOutputStream(zos, md);

    // write data        
    zos.putNextEntry(new ZipEntry(DATA_ZIP_ENTRY));
    CsvWriter cwriter = new CsvWriter(dos, VaultCsvEntry.CSV_DELIMITER,
            Charset.forName("UTF-8"));

    cwriter.writeRecord(((CsvEntry) csvEntries.get(0)).getCsvHeaderRecord());
    for (ExportEntry item : csvEntries) {
        cwriter.writeRecord(((CsvEntry) item).toCsvRecord());
    }
    cwriter.flush();

    // add signature file
    zos.putNextEntry(new ZipEntry(SIGNATURE_ZIP_ENTRY));
    String sigString = (new HexBinaryAdapter()).marshal(md.digest());
    zos.write(sigString.getBytes(), 0, sigString.getBytes().length);

    // close everything
    cwriter.close();
    dos.close();
    zos.close();
    fileOutpuStream.close();
}
 
Example 34
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test31() throws Exception {
	CsvWriter writer = new CsvWriter(new PrintWriter(
			new OutputStreamWriter(new FileOutputStream("temp.csv"),
					Charset.forName("UTF-8"))), ',');
	// writer will trim all whitespace and put this in quotes to preserve
	// it's existence
	writer.write(" \t \t");
	writer.close();

	CsvReader reader = new CsvReader(new InputStreamReader(
			new FileInputStream("temp.csv"), Charset.forName("UTF-8")));
	Assert.assertTrue(reader.readRecord());
	Assert.assertEquals("", reader.get(0));
	Assert.assertEquals(1, reader.getColumnCount());
	Assert.assertEquals(0L, reader.getCurrentRecord());
	Assert.assertEquals("\"\"", reader.getRawRecord());
	Assert.assertFalse(reader.readRecord());
	reader.close();

	new File("temp.csv").delete();
}
 
Example 35
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test54() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.endRecord();
	Assert.assertFalse(writer.getForceQualifier());
	writer.setForceQualifier(true);
	Assert.assertTrue(writer.getForceQualifier());
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert
			.assertEquals(
					"\"1,2\",3,\"blah \"\"some stuff in quotes\"\"\"\r\n\"1,2\",\"3\",\"blah \"\"some stuff in quotes\"\"\"",
					data);
}
 
Example 36
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test73() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	Assert.assertEquals(CsvWriter.ESCAPE_MODE_DOUBLED, writer
			.getEscapeMode());
	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);
	Assert.assertEquals(CsvWriter.ESCAPE_MODE_BACKSLASH, writer
			.getEscapeMode());
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.endRecord();
	writer.setForceQualifier(true);
	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();
	Assert
			.assertEquals(
					"\"1,2\",3,\"blah \\\"some stuff in quotes\\\"\"\r\n\"1,2\",\"3\",\"blah \\\"some stuff in quotes\\\"\"",
					data);
}
 
Example 37
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test112() throws Exception {
	try {
		new CsvWriter((String) null, ',', Charset
				.forName("ISO-8859-1"));
	} catch (Exception ex) {
		assertException(new IllegalArgumentException("Parameter fileName can not be null."), ex);
	}
}
 
Example 38
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test113() throws Exception {
	try {
		new CsvWriter("test.csv", ',', (Charset) null);
	} catch (Exception ex) {
		assertException(new IllegalArgumentException("Parameter charset can not be null."), ex);
	}
}
 
Example 39
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test114() throws Exception {
	try {
		new CsvWriter((Writer) null, ',');
	} catch (Exception ex) {
		assertException(new IllegalArgumentException("Parameter outputStream can not be null."), ex);
	}
}
 
Example 40
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test115() throws Exception {
	try {
		CsvWriter writer = new CsvWriter("test.csv");

		writer.close();

		writer.write("");
	} catch (Exception ex) {
		assertException(new IOException("This instance of the CsvWriter class has already been closed."), ex);
	}
}
 
Example 41
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test117() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	Assert.assertEquals('#', writer.getComment());
	writer.setComment('~');
	Assert.assertEquals('~', writer.getComment());

	writer.setRecordDelimiter(';');

	writer.write("1");
	writer.endRecord();
	writer.writeComment("blah");

	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("1;~blah;", data);
}
 
Example 42
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test118() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, '\t', Charset
			.forName("ISO-8859-1"));
	Assert.assertEquals('\"', writer.getTextQualifier());
	writer.setTextQualifier('\'');
	Assert.assertEquals('\'', writer.getTextQualifier());

	writer.write("1,2");
	writer.write("3");
	writer.write("blah \"some stuff in quotes\"");
	writer.write("blah \'some stuff in quotes\'");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert
			.assertEquals(
					"1,2\t3\tblah \"some stuff in quotes\"\t\'blah \'\'some stuff in quotes\'\'\'\r\n",
					data);
}
 
Example 43
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test119() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("1,2");
	writer.write("3");
	writer.endRecord();

	Assert.assertEquals(',', writer.getDelimiter());
	writer.setDelimiter('\t');
	Assert.assertEquals('\t', writer.getDelimiter());

	writer.write("1,2");
	writer.write("3");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"1,2\",3\r\n1,2\t3\r\n", data);
}
 
Example 44
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test123() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.write("#123");
	writer.endRecord();

	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);
	writer.setUseTextQualifier(false);

	writer.write("#123");
	writer.endRecord();

	writer.write("#");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("\"#123\"\r\n\\#123\r\n\\#\r\n", data);
}
 
Example 45
Project: OpenDiabetes   File: AllTests.java   Source Code and License 5 votes vote down vote up
@Test
public void test131() throws Exception {
	byte[] buffer;

	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	CsvWriter writer = new CsvWriter(stream, ',', Charset
			.forName("ISO-8859-1"));
	writer.setUseTextQualifier(false);
	writer.setEscapeMode(CsvWriter.ESCAPE_MODE_BACKSLASH);

	writer.write("1,\\\r\n2");
	writer.endRecord();

	writer.setRecordDelimiter(';');

	writer.write("1,\\;2");
	writer.endRecord();
	writer.close();

	buffer = stream.toByteArray();
	stream.close();

	String data = Charset.forName("ISO-8859-1").decode(
			ByteBuffer.wrap(buffer)).toString();

	Assert.assertEquals("1\\,\\\\\\\r\\\n2\r\n1\\,\\\\\\;2;", data);
}
 
Example 46
Project: BachelorPraktikum   File: CSVFileExporter.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
protected void writeToFile(final List<ExportEntry> csvEntries) throws IOException {
    FileOutputStream fileOutputStream = getFileOutputStream();
    CsvWriter cwriter = new CsvWriter(fileOutputStream, VaultCsvEntry.CSV_DELIMITER, Charset.forName("UTF-8"));

    cwriter.writeRecord(((CsvEntry) csvEntries.get(0)).getCsvHeaderRecord());
    for (ExportEntry item : csvEntries) {
        cwriter.writeRecord(((CsvEntry) item).toCsvRecord());
    }
    cwriter.flush();
    cwriter.close();
}
 
Example 47
Project: ipst   File: LocalOnlineApplication.java   Source Code and License 5 votes vote down vote up
private void writeCsvViolations(String basecase, List<LimitViolation> networkViolations, CsvWriter cvsWriter)
        throws IOException {
    for (LimitViolation violation : networkViolations) {
        String[] values = new String[] {basecase, violation.getSubjectId(), violation.getLimitType().name(),
                Float.toString(violation.getValue()), Float.toString(violation.getLimit()) };
        cvsWriter.writeRecord(values);
    }
    cvsWriter.flush();
}
 
Example 48
Project: sistra   File: CsvUtil.java   Source Code and License 5 votes vote down vote up
/**
 * Exporta a csv.
 * 
 * @param is InputStream
 * @throws Exception
 */
public static byte[] exportar(CsvDocumento csv) throws Exception{
	
	ByteArrayOutputStream bos = new ByteArrayOutputStream(8192);
	Writer writer = new OutputStreamWriter(bos, "ISO-8859-1");
	CsvWriter csvOutput = new CsvWriter(writer,CHAR_DELIMITIER);

	// Headers
	for (int columna = 0; columna < csv.getColumnas().length; columna++) {
		csvOutput.write(csv.getColumnas()[columna]);		
	}	
	csvOutput.endRecord();
	
	// Datos
	for (int fila = 0; fila < csv.getNumeroFilas(); fila++) {			
		for (int columna = 0; columna < csv.getColumnas().length; columna++) {
		String col = csv.getColumnas()[columna];
		csvOutput.write(csv.getValor(fila, col));	
		}
		csvOutput.endRecord();
	}
           
       csvOutput.close();
       
       byte[] res = bos.toByteArray();
       return res;
}
 
Example 49
Project: dhis2-core   File: StreamingCsvDataValueSet.java   Source Code and License 5 votes vote down vote up
public StreamingCsvDataValueSet( CsvWriter writer )
{
    this.writer = writer;
    
    try
    {
        this.writer.writeRecord( StreamingCsvDataValue.getHeaders() ); // Write headers
    }
    catch ( IOException ex )
    {
        throw new RuntimeException( "Failed to write CSV headers", ex );
    }
}
 
Example 50
Project: dhis2-core   File: SpringDataValueSetStore.java   Source Code and License 5 votes vote down vote up
@Override
public void writeDataValueSetCsv( DataExportParams params, Date completeDate, Writer writer )
{
    DataValueSet dataValueSet = new StreamingCsvDataValueSet( new CsvWriter( writer, CSV_DELIM ) );

    String sql = getDataValueSql( params );

    writeDataValueSet( sql, params, completeDate, dataValueSet );

    IOUtils.closeQuietly( writer );
}
 
Example 51
Project: dhis2-core   File: GridUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Writes a CSV representation of the given Grid to the given OutputStream.
 */
public static void toCsv( Grid grid, Writer writer )
    throws IOException
{
    if ( grid == null )
    {
        return;
    }

    CsvWriter csvWriter = new CsvWriter( writer, CSV_DELIMITER );

    Iterator<GridHeader> headers = grid.getHeaders().iterator();

    if ( !grid.getHeaders().isEmpty() )
    {
        while ( headers.hasNext() )
        {
            csvWriter.write( headers.next().getColumn() );
        }

        csvWriter.endRecord();
    }

    for ( List<Object> row : grid.getRows() )
    {
        for ( Object value : row )
        {
            csvWriter.write( value != null ? String.valueOf( value ) : StringUtils.EMPTY );
        }

        csvWriter.endRecord();
    }
}
 
Example 52
Project: gtfs-lib   File: Entity.java   Source Code and License 5 votes vote down vote up
public void writeTable (ZipOutputStream zip) throws IOException {
    LOG.info("Writing GTFS table {}", tableName);

    ZipEntry zipEntry = new ZipEntry(tableName + ".txt");
    zip.putNextEntry(zipEntry);

    // don't let CSVWriter close the stream when it is garbage-collected
    OutputStream protectedOut = new UncloseableOutputStream(zip);
    this.writer = new CsvWriter(protectedOut, ',', Charset.forName("UTF8"));

    this.writeHeaders();

    // write rows until there are none left.
    row = 0;        	
    Iterator<E> iter = this.iterator();
    while (iter.hasNext()) {
        if (++row % 500000 == 0) {
            LOG.info("Record number {}", human(row));
        }

        writeOneRow(iter.next());
    }

    // closing the writer closes the underlying output stream, so we don't do that.
    writer.flush();
    zip.closeEntry();

    LOG.info("Wrote {} rows", human(row));
}
 
Example 53
Project: demschooltools   File: Attendance.java   Source Code and License 5 votes vote down vote up
private byte[] getDailyHoursFile(TreeSet<Date> allDates,
                                 TreeMap<String, HashMap<Date, AttendanceDay>> personDateAttendance,
                                 Charset charset) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    CsvWriter writer = new CsvWriter(baos, ',', charset);
    writer.write("Name");
    for (Date d : allDates) {
        writer.write(Application.yymmddDate(d));
    }
    writer.endRecord();

    for (String name : personDateAttendance.keySet()) {
        writer.write(name);
        for (Date date : allDates) {
            AttendanceDay day = personDateAttendance.get(name).get(date);
            if (day == null || day.start_time == null || day.end_time == null) {
                writer.write(day == null || day.code == null ? "" : day.code);
            } else {
                writer.write(String.format("%.2f", day.getHours()));
            }
        }
        writer.endRecord();
    }

    writer.close();
    return baos.toByteArray();
}
 
Example 54
Project: demschooltools   File: Attendance.java   Source Code and License 5 votes vote down vote up
private byte[] getDailySigninsFile(TreeSet<Date> allDates,
        TreeMap<String, HashMap<Date, AttendanceDay>> personDateAttendance,
        Charset charset) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    CsvWriter writer = new CsvWriter(baos, ',', charset);
    writer.write("Name");
    for (Date d : allDates) {
        writer.write(Application.yymmddDate(d));
    }
    writer.endRecord();

    SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
    for (String name : personDateAttendance.keySet()) {
        for (int x = 0; x < 2; x++) {
            writer.write(x == 0 ? name : "");
            for (Date date : allDates) {
                AttendanceDay day = personDateAttendance.get(name).get(date);
                if (day == null || day.start_time == null || day.end_time == null) {
                    writer.write(day == null || day.code == null ? "" : day.code);
                } else {
                    writer.write(dateFormat.format(x == 0 ? day.start_time : day.end_time));
                }
            }
            writer.endRecord();
        }
    }

    writer.close();
    return baos.toByteArray();
}
 
Example 55
Project: AgileAlligators   File: StreamingCsvDataValueSet.java   Source Code and License 5 votes vote down vote up
public StreamingCsvDataValueSet( CsvWriter writer )
{
    this.writer = writer;
    
    try
    {
        this.writer.writeRecord( StreamingCsvDataValue.getHeaders() ); // Write headers
    }
    catch ( IOException ex )
    {
        throw new RuntimeException( "Failed to write CSV headers", ex );
    }
}
 
Example 56
Project: AgileAlligators   File: SpringDataValueSetStore.java   Source Code and License 5 votes vote down vote up
@Override
public void writeDataValueSetCsv( DataExportParams params, Date completeDate, Writer writer )
{
    DataValueSet dataValueSet = new StreamingCsvDataValueSet( new CsvWriter( writer, CSV_DELIM ) );

    writeDataValueSet( getDataValueSql( params ), params, completeDate, dataValueSet );

    IOUtils.closeQuietly( writer );
}
 
Example 57
Project: AgileAlligators   File: GridUtils.java   Source Code and License 5 votes vote down vote up
/**
 * Writes a CSV representation of the given Grid to the given OutputStream.
 */
public static void toCsv( Grid grid, Writer writer )
    throws Exception
{
    if ( grid == null )
    {
        return;
    }
    
    CsvWriter csvWriter = new CsvWriter( writer, CSV_DELIMITER );
    
    Iterator<GridHeader> headers = grid.getHeaders().iterator();
    
    if ( !grid.getHeaders().isEmpty() )
    {
        while ( headers.hasNext() )
        {
            csvWriter.write( headers.next().getColumn() );
        }
        
        csvWriter.endRecord();
    }
    
    for ( List<Object> row : grid.getRows() )
    {
        Iterator<Object> columns = row.iterator();
        
        while ( columns.hasNext() )
        {
            Object value = columns.next();
            
            csvWriter.write( value != null ? String.valueOf( value ) : StringUtils.EMPTY );
        }
        
        csvWriter.endRecord();
    }
}
 
Example 58
Project: components   File: BulkFileWriter.java   Source Code and License 5 votes vote down vote up
@Override
public void open(String uId) throws IOException {
    this.uId = uId;
    this.result = new Result(uId);
    String filepath = bulkProperties.bulkFilePath.getStringValue();
    if (filepath == null || filepath.isEmpty()) {
        throw new RuntimeException("Please set a valid value for \"Bulk File Path\" field.");
    }
    File file = new File(bulkProperties.bulkFilePath.getStringValue());
    file.getParentFile().mkdirs();
    csvWriter = new CsvWriter(new OutputStreamWriter(new java.io.FileOutputStream(file, isAppend), charset), separator);

    fileIsEmpty = (file.length() == 0);
}
 
Example 59
Project: components   File: BulkResultSetTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testResultSet() throws IOException {

    final int recordCount = 100;

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    CsvWriter csvWriter = new CsvWriter(new BufferedOutputStream(out),
            ',', Charset.forName("UTF-8"));

    for (int i = 0; i < recordCount; i++) {
        csvWriter.writeRecord(new String[]{
                "fieldValueA" + i,
                "fieldValueB" + i,
                "fieldValueC" + i
        });
    }
    csvWriter.close();

    CsvReader csvReader = new CsvReader(
            new BufferedInputStream(new ByteArrayInputStream(out.toByteArray())),
            ',', Charset.forName("UTF-8"));

    BulkResultSet resultSet = new BulkResultSet(csvReader, Arrays.asList("fieldA", "fieldB", "fieldC"));

    int count = 0;
    BulkResult result;
    while ((result = resultSet.next()) != null) {
        assertEquals("fieldValueA" + count, result.getValue("fieldA"));
        assertEquals("fieldValueB" + count, result.getValue("fieldB"));
        assertEquals("fieldValueC" + count, result.getValue("fieldC"));

        count++;
    }

    assertEquals(recordCount, count);
}
 
Example 60
Project: SimulacaoAD   File: ControladorArquivos.java   Source Code and License 5 votes vote down vote up
public ControladorArquivos(File arquivo)
{
	try
	{
		csvWriter = new CsvWriter(new FileWriter(arquivo, APENDAR_CONTEUDO), SEPARADOR_CSV);
	} 
	catch (IOException e)
	{
		throw new GerarArquivoCSVException(e);
	}
}