Skip to content

Commit

Permalink
Merge pull request #15 from linl33/fix-download-csv
Browse files Browse the repository at this point in the history
Replace writer for CSV output
  • Loading branch information
wbrunette committed Apr 19, 2018
2 parents bff6845 + f5ca515 commit c0b3bdd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/org/opendatakit/suitcase/net/DownloadTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import org.opendatakit.suitcase.ui.SuitcaseProgressBar;
import org.opendatakit.suitcase.utils.FileUtils;

import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.ExecutionException;

import static org.opendatakit.suitcase.ui.MessageString.*;
Expand Down Expand Up @@ -72,8 +74,11 @@ protected Void doInBackground() throws IOException, JSONException {
publish(new ProgressBarStatus(0, PROCESSING_ROW, false));
RFC4180CsvWriter csvWriter = null;
try {
csvWriter = new RFC4180CsvWriter(new FileWriter(
FileUtils.getCSVPath(cloudEndpointInfo, csv.getTableId(), csvConfig, savePath).toString()
csvWriter = new RFC4180CsvWriter(Files.newBufferedWriter(
FileUtils.getCSVPath(cloudEndpointInfo, csv.getTableId(), csvConfig, savePath),
StandardCharsets.UTF_8,
StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING
));

//Write header then rows
Expand Down

0 comments on commit c0b3bdd

Please sign in to comment.