/**
* 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);
/**
* 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 {
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 {
out.write('\n');
out.flush();
} catch (IOException e) {
- throw new UtilsException("Could not write " + tokens, e);
+ throw new RuntimeException("Could not write " + tokens, e);
}
}