BeanIO 1.2.3

org.beanio.stream.csv
Class CsvWriterFactory

java.lang.Object
  extended by org.beanio.stream.csv.CsvWriterFactory
All Implemented Interfaces:
RecordWriterFactory

public class CsvWriterFactory
extends Object
implements RecordWriterFactory

This record writer factory is used to create and configure a CsvWriter.

Since:
1.0
Author:
Kevin Seim
See Also:
CsvWriter

Constructor Summary
CsvWriterFactory()
           
 
Method Summary
 RecordWriter createWriter(Writer out)
          Creates a new RecordWriter to write to an output stream.
 char getDelimiter()
          Returns the field delimiter.
 char getEscape()
          Returns the escape character.
 String getLineSeparator()
          Deprecated.  
 char getQuote()
          Returns the character to use for a quotation mark.
 String getRecordTerminator()
          Returns the text used to terminate a record.
 boolean isAlwaysQuote()
          Returns true if fields should always be quoted.
 void setAlwaysQuote(boolean alwaysQuote)
          Set to true to quote every field.
 void setDelimiter(char c)
          Sets the field delimiter.
 void setEscape(char c)
          Sets the escape character.
 void setLineSeparator(String lineSeparator)
          Deprecated.  
 void setQuote(char quote)
          Sets the character to use for a quotation mark.
 void setRecordTerminator(String recordTerminator)
          Sets the text used to terminate a record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvWriterFactory

public CsvWriterFactory()
Method Detail

createWriter

public RecordWriter createWriter(Writer out)
Description copied from interface: RecordWriterFactory
Creates a new RecordWriter to write to an output stream.

Specified by:
createWriter in interface RecordWriterFactory
Parameters:
out - the output stream to write to
Returns:
the new RecordWriter

setDelimiter

public void setDelimiter(char c)
Sets the field delimiter. By default, the delimiter is a comma.

Parameters:
c - the character used to delimit fields

getQuote

public char getQuote()
Returns the character to use for a quotation mark. Defaults to '"'.

Returns:
the quotation mark character

setQuote

public void setQuote(char quote)
Sets the character to use for a quotation mark.

Parameters:
quote - the new quotation mark character

getDelimiter

public char getDelimiter()
Returns the field delimiter. By default, the delimiter is a comma.

Returns:
the character used to delimit fields

setEscape

public void setEscape(char c)
Sets the escape character. Quotation marks are escaped within quoted values using the escape character.

Parameters:
c - the new escape character

getEscape

public char getEscape()
Returns the escape character. Quotation marks are escaped within quoted values using the escape character.

Returns:
the escape character

isAlwaysQuote

public boolean isAlwaysQuote()
Returns true if fields should always be quoted. Defaults to false which will only quote fields containing a quotation mark, delimiter, line feeds or carriage return.

Returns:
true if all fields will be quoted

setAlwaysQuote

public void setAlwaysQuote(boolean alwaysQuote)
Set to true to quote every field. If false, a field will only be quoted if it contains a quotation mark, delimiter, line feed or carriage return.

Parameters:
alwaysQuote - set to true to quote every field regardless of content

getRecordTerminator

public String getRecordTerminator()
Returns the text used to terminate a record. By default, the record terminator is set to the value of the line.separator system property.

Returns:
the record termination text

setRecordTerminator

public void setRecordTerminator(String recordTerminator)
Sets the text used to terminate a record. If set to null, the the value of the line.separator system property is used to terminate records.

Parameters:
recordTerminator - the record termination text

getLineSeparator

public String getLineSeparator()
Deprecated. 

Returns the text used to terminate a record. By default, the line separator is set using the 'line.separator' system property.

Returns:
the line separation text

setLineSeparator

public void setLineSeparator(String lineSeparator)
Deprecated. 

Sets the text used to terminate a record. If set to null, the default line separator is used based on the 'line.separator' system property.

Parameters:
lineSeparator - the line separation text

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim