|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.csv.CSVPrinter
public class CSVPrinter
Print values as a comma separated list.
Field Summary | |
---|---|
protected boolean |
newLine
True if we just began a new line. |
protected java.io.PrintWriter |
out
The place that the values get written. |
private CSVStrategy |
strategy
|
Constructor Summary | |
---|---|
CSVPrinter(java.io.OutputStream out)
Create a printer that will print values to the given stream. |
|
CSVPrinter(java.io.Writer out)
Create a printer that will print values to the given stream. |
Method Summary | |
---|---|
private java.lang.String |
escapeAndQuote(java.lang.String value)
Enclose the value in quotes and escape the quote and comma characters that are inside. |
CSVStrategy |
getStrategy()
Obtain the specified CSV Strategy |
void |
print(java.lang.String value)
Print the string as the next value on the line. |
void |
println()
Output a blank line |
void |
println(java.lang.String value)
Print the string as the last value on the line. |
void |
println(java.lang.String[] values)
Print a single line of comma separated values. |
void |
println(java.lang.String[][] values)
Print several lines of comma separated values. |
void |
printlnComment(java.lang.String comment)
Put a comment among the comma separated values. |
CSVPrinter |
setStrategy(CSVStrategy strategy)
Sets the specified CSV Strategy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.PrintWriter out
protected boolean newLine
private CSVStrategy strategy
Constructor Detail |
---|
public CSVPrinter(java.io.OutputStream out)
out
- stream to which to print.public CSVPrinter(java.io.Writer out)
out
- stream to which to print.Method Detail |
---|
public CSVPrinter setStrategy(CSVStrategy strategy)
public CSVStrategy getStrategy()
public void println(java.lang.String value)
value
- value to be outputted.public void println()
public void println(java.lang.String[] values)
values
- values to be outputted.public void println(java.lang.String[][] values)
values
- values to be outputted.public void printlnComment(java.lang.String comment)
comment
- the comment to outputpublic void print(java.lang.String value)
value
- value to be outputted.private java.lang.String escapeAndQuote(java.lang.String value)
value
- needs to be escaped and quoted
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |