|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.csvreader.CsvWriter
A stream based writer for writing delimited text data to a file or a stream.
Nested Class Summary | |
class |
CsvWriter.FinalizedException
Methods are being called on an object that has already been finalized. |
Constructor Summary | |
CsvWriter(OutputStream outputStream,
char delimiter,
Charset charset)
Creates a CsvWriter object using an
OutputStream to write data to. |
|
CsvWriter(String fileName)
Creates a CsvWriter object using a
file as the data destination. |
|
CsvWriter(String fileName,
char delimiter,
Charset charset)
Creates a CsvWriter object using a
file as the data destination. |
|
CsvWriter(Writer outputStream,
char delimiter)
Creates a CsvWriter object using a
Writer to write data to. |
Method Summary | |
void |
close()
Closes and releases all related resources. |
void |
endRecord()
Ends the current record by sending the record delimiter. |
void |
flush()
Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. |
char |
getDelimiter()
Gets the character being used as the column delimiter. |
char |
getTextQualifier()
Gets the character to use as a text qualifier in the data. |
boolean |
getUseTextQualifier()
Whether text qualifiers will be used while writing data or not. |
void |
setDelimiter(char delimiter)
Sets the character to use as the column delimiter. |
void |
setTextQualifier(char textQualifier)
Sets the character to use as a text qualifier in the data. |
void |
setUseTextQualifier(boolean useTextQualifier)
Sets whether text qualifiers will be used while writing data or not. |
void |
write(String content)
Writes another column of data to this record. |
void |
write(String content,
boolean preserveSpaces)
Writes another column of data to this record. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CsvWriter(String fileName, char delimiter, Charset charset)
CsvWriter
object using a
file as the data destination.
fileName
- The path to the file to output the data.delimiter
- The character to use as the column delimiter.charset
- The Charset
to use while writing the data.public CsvWriter(String fileName)
CsvWriter
object using a
file as the data destination. Uses a comma as the column
delimiter and ISO-8859-1 as the Charset
.
fileName
- The path to the file to output the data.public CsvWriter(Writer outputStream, char delimiter)
CsvWriter
object using a
Writer to write data to.
outputStream
- The stream to write the column delimited data to.delimiter
- The character to use as the column delimiter.public CsvWriter(OutputStream outputStream, char delimiter, Charset charset)
CsvWriter
object using an
OutputStream to write data to.
outputStream
- The stream to write the column delimited data to.delimiter
- The character to use as the column delimiter.charset
- The Charset
to use while writing the data.Method Detail |
public char getDelimiter()
public void setDelimiter(char delimiter)
delimiter
- The character to use as the column delimiter.public char getTextQualifier()
public void setTextQualifier(char textQualifier)
textQualifier
- The character to use as a text qualifier in the data.public boolean getUseTextQualifier()
public void setUseTextQualifier(boolean useTextQualifier)
useTextQualifier
- Whether to use a text qualifier while writing data or not.public void write(String content, boolean preserveSpaces) throws CsvWriter.FinalizedException, IOException
content
- The data for the new column.preserveSpaces
- Whether to preserve leading and trailing whitespace in
this column of data.
CsvWriter.FinalizedException
- Thrown if this object has already been closed
or finalized.
IOException
- Thrown if an error occurs while writing data
to the destination stream.public void write(String content) throws CsvWriter.FinalizedException, IOException
content
- The data for the new column.
CsvWriter.FinalizedException
- Thrown if this object has already been closed
or finalized.
IOException
- Thrown if an error occurs while writing data
to the destination stream.public void endRecord() throws CsvWriter.FinalizedException, IOException
CsvWriter.FinalizedException
- Thrown if this object has already been closed
or finalized.
IOException
- Thrown if an error occurs while writing data
to the destination stream.public void flush()
public void close()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |