|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.stream.delimited.DelimitedWriter
public class DelimitedWriter
A DelimitedWriter is used to write records to delimited flat files. Each record must be a String array of fields. By default, fields are delimited by the tab character, but any other single character may be configured instead.
If an escape character is configured, any field containing the delimiter will be escaped by placing the escape character immediately before the delimiter. For example, if the record "Field1,2", "Field3" is written using a comma delimiter and backslash escape character, the following text will be written to the output stream:
Field1\,2,Field3Note that no validation is performed when a record is written, so if an escape character is not configured and a field contains a delimiting character, the generated output may be invalid.
Constructor Summary | |
---|---|
DelimitedWriter(Writer out)
Constructs a new DelimitedWriter. |
|
DelimitedWriter(Writer out,
char delimiter)
Constructs a new DelimitedWriter. |
|
DelimitedWriter(Writer out,
DelimitedParserConfiguration config)
Constructs a new DelimitedWriter. |
Method Summary | |
---|---|
void |
close()
Closes the output stream. |
void |
flush()
Flushes the output stream. |
void |
write(Object value)
Writes a record object to this output stream. |
void |
write(String[] record)
Writes a record to the output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DelimitedWriter(Writer out)
out
- the output stream to write topublic DelimitedWriter(Writer out, char delimiter)
out
- the output stream to write todelimiter
- the field delimiting characterpublic DelimitedWriter(Writer out, DelimitedParserConfiguration config)
out
- the output stream to write toconfig
- the delimited parser configurationMethod Detail |
---|
public void write(Object value) throws IOException, RecordIOException
RecordWriter
write
in interface RecordWriter
value
- the record object to write
IOException
- if an I/O error occurs writing the record to the stream
RecordIOException
public void write(String[] record) throws IOException
record
- the record to write
IOException
- if an I/O error occurspublic void flush() throws IOException
RecordWriter
flush
in interface RecordWriter
IOException
- if an I/O error occurs flushing the streampublic void close() throws IOException
RecordWriter
close
in interface RecordWriter
IOException
- if an I/O error occurs closing the stream
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |