branch feature/3798_new_export_API updated (8324b6e -> ada693e)
This is an automated email from the git hooks/post-receive script. New change to branch feature/3798_new_export_API in repository nuiton-csv. See http://git.nuiton.org/nuiton-csv.git from 8324b6e Introduce new Exporter API (Refs #3798) new ada693e Prefer use a StringWriter to export to string, rather than using a ByteArrayOutputStream The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit ada693efb717d0db2abce17f6a8a3aa8c80fb18b Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Dec 10 09:29:48 2015 +0100 Prefer use a StringWriter to export to string, rather than using a ByteArrayOutputStream Summary of changes: src/main/java/org/nuiton/csv/Exporter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/3798_new_export_API in repository nuiton-csv. See http://git.nuiton.org/nuiton-csv.git commit ada693efb717d0db2abce17f6a8a3aa8c80fb18b Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Dec 10 09:29:48 2015 +0100 Prefer use a StringWriter to export to string, rather than using a ByteArrayOutputStream --- src/main/java/org/nuiton/csv/Exporter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/nuiton/csv/Exporter.java b/src/main/java/org/nuiton/csv/Exporter.java index 17ba5b2..60193c2 100644 --- a/src/main/java/org/nuiton/csv/Exporter.java +++ b/src/main/java/org/nuiton/csv/Exporter.java @@ -3,13 +3,13 @@ package org.nuiton.csv; import com.google.common.base.Preconditions; import org.nuiton.util.StringUtil; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; +import java.io.StringWriter; import java.io.Writer; import java.util.Iterator; @@ -219,11 +219,11 @@ public class Exporter<O> { */ public String exportToString(Iterable<O> data, boolean writeHeader) throws IOException { - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { + try (StringWriter writer = new StringWriter()) { - exportToOutputStream(data, writeHeader, outputStream); + exportToWriter(data, writeHeader, writer); - String result = new String(outputStream.toByteArray(), configuration.getCharset()); + String result = writer.toString(); return result; } -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm