X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.util%2Fsrc%2Forg%2Fargeo%2Futil%2FCsvWriter.java;h=97b5191035d83e41d1402b0eff0ff0595b74f03c;hb=986233dff943b24e545caecaa4658639c36172eb;hp=ba5b3c710ebd928ee5645041cdc3aa53550e5a72;hpb=0b15752581b8fffd1913478240b63327781ec32a;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.util/src/org/argeo/util/CsvWriter.java b/org.argeo.util/src/org/argeo/util/CsvWriter.java index ba5b3c710..97b519103 100644 --- a/org.argeo.util/src/org/argeo/util/CsvWriter.java +++ b/org.argeo.util/src/org/argeo/util/CsvWriter.java @@ -18,8 +18,7 @@ public class CsvWriter { /** * Creates a CSV writer. * - * @param out - * the stream to write to. Caller is responsible for closing it. + * @param out the stream to write to. Caller is responsible for closing it. */ public CsvWriter(OutputStream out) { this.out = new OutputStreamWriter(out); @@ -28,21 +27,19 @@ public class CsvWriter { /** * Creates a CSV writer. * - * @param out - * the stream to write to. Caller is responsible for closing it. + * @param out the stream to write to. Caller is responsible for closing it. */ public CsvWriter(OutputStream out, String encoding) { try { this.out = new OutputStreamWriter(out, encoding); } catch (UnsupportedEncodingException e) { - throw new UtilsException("Cannot initialize CSV writer", e); + throw new IllegalArgumentException(e); } } /** - * Write a CSV line. Also used to write a header if needed (this is - * transparent for the CSV writer): simply call it first, before writing the - * lines. + * Write a CSV line. Also used to write a header if needed (this is transparent + * for the CSV writer): simply call it first, before writing the lines. */ public void writeLine(List tokens) { try { @@ -55,14 +52,13 @@ public class CsvWriter { out.write('\n'); out.flush(); } catch (IOException e) { - throw new UtilsException("Could not write " + tokens, e); + throw new RuntimeException("Could not write " + tokens, e); } } /** - * Write a CSV line. Also used to write a header if needed (this is - * transparent for the CSV writer): simply call it first, before writing the - * lines. + * Write a CSV line. Also used to write a header if needed (this is transparent + * for the CSV writer): simply call it first, before writing the lines. */ public void writeLine(Object[] tokens) { try { @@ -79,7 +75,7 @@ public class CsvWriter { out.write('\n'); out.flush(); } catch (IOException e) { - throw new UtilsException("Could not write " + tokens, e); + throw new RuntimeException("Could not write " + tokens, e); } }