public class CSVWriter extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CSVWriter.DefaultValueWriter |
static interface |
CSVWriter.ValueWriter |
| Constructor and Description |
|---|
CSVWriter(Writer pw)
convenience Constructor, defaults to quotelevel 1, comma separator , trim
|
CSVWriter(Writer pw,
int quoteLevel,
char separator,
char quote,
boolean trim)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the PrintWriter.
|
int |
getColumnOfLine()
getColumnOfLine.
|
String |
getDefaultNullValue()
Getter for the field
defaultNullValue. |
String |
getLineSeparator()
Getter for the field
lineSeparator. |
PrintWriter |
getPrintWriter()
getPrintWriter.
|
char |
getQuote()
Getter for the field
quote. |
int |
getQuoteLevel()
Getter for the field
quoteLevel. |
CSVWriter.ValueWriter |
getValueWriter()
getValueWriter.
|
boolean |
isTrim()
isTrim.
|
void |
nl()
Write a new line in the CVS output file to demark the end of record.
|
void |
print(Object... values)
print.
|
void |
println(Object... values)
println.
|
void |
put(String... values)
Write one csv field to the file, followed by a separator unless it is the
last field on the line.
|
void |
setDefaultNullValue(String in)
Set default value if put() gets a value of null.
|
void |
setLineSeparator(String lineSeparator)
Setter for the field
lineSeparator. |
void |
setValueWriter(CSVWriter.ValueWriter writer)
setValueWriter.
|
public CSVWriter(Writer pw)
pw - Writer where fields will be written.public CSVWriter(Writer pw, int quoteLevel, char separator, char quote, boolean trim)
pw - Writer where fields will be written.quoteLevel - 0 = minimal quotes separator - field separator character, usually ',' in North America, ';'
in Europe and sometimes '\t' for tab.quote - char to use to enclose fields containing a separator, usually
'\"'trim - true if writer should trim leading/trailing whitespace (e.g.
blank, cr, Lf, tab) before writing the field.public void close()
public void setDefaultNullValue(String in)
in - a String object.public String getDefaultNullValue()
Getter for the field defaultNullValue.
String object.public void nl()
public void put(String... values)
values - a String object.public String getLineSeparator()
Getter for the field lineSeparator.
String object.public void setLineSeparator(String lineSeparator)
Setter for the field lineSeparator.
lineSeparator - a String object.public boolean isTrim()
isTrim.
public char getQuote()
Getter for the field quote.
public PrintWriter getPrintWriter()
getPrintWriter.
PrintWriter object.public int getQuoteLevel()
Getter for the field quoteLevel.
public int getColumnOfLine()
getColumnOfLine.
public CSVWriter.ValueWriter getValueWriter()
getValueWriter.
CSVWriter.ValueWriter object.public void setValueWriter(CSVWriter.ValueWriter writer)
setValueWriter.
writer - a CSVWriter.ValueWriter object.Copyright © 2016. All Rights Reserved.