|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectolg.csv.base.csv.CSVWriter
public class CSVWriter
CSV writer. CSV Implementation of IWriter.
Constructor Summary | |
---|---|
CSVWriter(File outFile,
CSVSettings settings)
Constructor. |
|
CSVWriter(OutputStream out,
CSVSettings settings)
Constructor. |
Method Summary | |
---|---|
void |
addLine(String[] values)
Adds a row from the given String array. |
void |
addRow(Row row)
Adds a row. |
void |
close()
Close this stream and caught and logged IOException. if the parent stream is provided and passed to CSVWriter constructor by user, user must close it (close what you open!) |
boolean |
isWithHeaders()
Indicates if the file has a headers line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CSVWriter(OutputStream out, CSVSettings settings)
out
- the stream on which to write. Must be not null
.settings
- the CSV settings to use to write on the stream. Must be not
null
and must have a not null
lineSeparator setting.for default values
public CSVWriter(File outFile, CSVSettings settings) throws FileNotFoundException
outFile
- the file to write. Must be not null
.settings
- the CSV settings to use to write on the file. Must be not
null
and have a not null
lineSeparator setting.
FileNotFoundException
- if the file exists but is a directory rather than a regular
file, does not exist but cannot be created, or cannot be
opened for any other reasonfor default values
Method Detail |
---|
public void addLine(String[] values)
IWriter.addRow(Row)
had been used first.
Throws a WriterException when line size differs from initial size.
addLine
in interface IWriter
values
- the row. Must be not null
with length >0. .public void addRow(Row row)
The first row allows to define the size used along writing unless
IWriter.addLine(String[])
had been used first.
Throws a WriterException when row size differs from initial size or row num is lesser than the expected next number line. Or if I/O error occurs during writing.
addRow
in interface IWriter
row
- the row. It's possible to use a row with no cells. In this
case, an empty line(a line wich all fields are null) is added.
It's possible to use a row with a num greater than the
expected number. In this case, empty lines are wroten as much
as necessary. It's possible to use row which all cells are not
specified. In this case the missing cells are added as empty
cells. Must be not null with cells correctly ordered and
size>0.public void close()
close
in interface Closeable
public boolean isWithHeaders()
isWithHeaders
in interface IWriter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |