<action issue="CSV-119" type="add" dev="ggregory" due-to="Sergei Lebedev">CSVFormat is missing a print(...) method</action>
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1599285 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2480dffa6d
commit
65f110ec14
|
@ -40,6 +40,7 @@
|
|||
<body>
|
||||
|
||||
<release version="1.0" date="TBD" description="First release">
|
||||
<action issue="CSV-119" type="add" dev="ggregory" due-to="Sergei Lebedev">CSVFormat is missing a print(...) method</action>
|
||||
<action issue="CSV-118" type="fix" dev="ggregory" due-to="Enrique Lara">CSVRecord.toMap() throws NPE on formats with no
|
||||
headers.</action>
|
||||
<action issue="CSV-113" type="fix" dev="sebb">Check whether ISE/IAE are being used appropriately</action>
|
||||
|
|
|
@ -595,6 +595,21 @@ public final class CSVFormat implements Serializable {
|
|||
return new CSVParser(in, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints to the specified output.
|
||||
*
|
||||
* <p>
|
||||
* See also {@link CSVPrinter}.
|
||||
* </p>
|
||||
*
|
||||
* @param out
|
||||
* the output
|
||||
* @return a printer to an output
|
||||
*/
|
||||
public CSVPrinter print(final Appendable out) {
|
||||
return new CSVPrinter(out, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -303,6 +303,15 @@ public class CSVPrinterTest {
|
|||
printer.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrint() throws IOException {
|
||||
final StringWriter sw = new StringWriter();
|
||||
final CSVPrinter printer = CSVFormat.DEFAULT.print(sw);
|
||||
printer.printRecord("a", "b\\c");
|
||||
assertEquals("a,b\\c" + recordSeparator, sw.toString());
|
||||
printer.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintNullValues() throws IOException {
|
||||
final StringWriter sw = new StringWriter();
|
||||
|
|
Loading…
Reference in New Issue