|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.converters.csv.CSVConfigurator
A class that defines the format of CSV file.
There is currently no such thing as CSV format. This class is ment to inform other classes what format should be used to produce or parse CSV files. It is especially imporant for parsers as it is very difficult to determine the exact convention used in CSV file automatically. Flexible format used here conforms to the following guidelines:
User can set the following parameters:
mLineBreak
- symbol used to delimit records (default: CRLF)mDelimiter
- character used to separate fields (default: ,)mNullDataStr
- string to represent null value fields (default: NULL)mIncludeHeader
- informs if toCSV converters should include header and if fromCSV parsers should treat first line as header (default: true),mEscapeFields
- informs if either all or none of the character based fields should be surrounded by double quotes. If user is sure that data will not require enclosing fields in double quotes this information can be used by toCSV converters to speed up their operation (default: true)Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE |
private java.lang.String |
mDelimiter |
private boolean |
mEscapeFields |
private boolean |
mIncludeHeader |
private java.lang.String |
mLineBreak |
private java.lang.String |
mLineBreakChars |
private java.lang.String |
mNullDataStr |
Constructor Summary | |
CSVConfigurator() |
Method Summary | |
java.lang.String |
getMDelimiter() Returns string used as delimiter for fields |
java.lang.String |
getMLineBreak() Returns lineBreak. |
java.lang.String |
getMLineBreakChars() Returns proper ASCII representation of lineBreak. |
java.lang.String |
getMNullDataStr() Returns string that is used to signify null data fields |
boolean |
isMEscapeFields() Informs if textual fields should be enclosed in double quotes |
boolean |
isMIncludeHeader() Informs if header line with column names is included. |
void |
setMDelimiter(java.lang.String delimiter) Set the delimiter used to separate fields. |
void |
setMEscapeFields(boolean escapeFields) Set the field informing about if fields should be surrounded by double quotes. |
void |
setMIncludeHeader(boolean includeHeader) Set the field informing about header line inclusion. |
void |
setMLineBreak(java.lang.String lineBreak) Set the code used to break lines. |
void |
setMNullDataStr(java.lang.String nullDataStr) Set the string that signifies null value fields. |
java.lang.String |
toString() |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private java.lang.String mLineBreakChars
private java.lang.String mLineBreak
private java.lang.String mDelimiter
private java.lang.String mNullDataStr
private boolean mIncludeHeader
private boolean mEscapeFields
Constructor Detail |
public CSVConfigurator()
Method Detail |
public java.lang.String getMLineBreakChars()
public java.lang.String getMLineBreak()
public void setMLineBreak(java.lang.String lineBreak) throws CSVConfigurationException
lineBreak
- Allowed values are: CR (used in UNIX), LF (used in Apple Mac), LFCR (used in Windows)CSVConfigurationException
public java.lang.String getMNullDataStr()
public void setMNullDataStr(java.lang.String nullDataStr) throws CSVConfigurationException
nullDataStr
-CSVConfigurationException
public boolean isMIncludeHeader()
public void setMIncludeHeader(boolean includeHeader)
includeHeader
- true if header is includedpublic java.lang.String getMDelimiter()
public void setMDelimiter(java.lang.String delimiter) throws CSVConfigurationException
delimiter
- Any single character except double quote can be used as delimiterCSVConfigurationException
public boolean isMEscapeFields()
public void setMEscapeFields(boolean escapeFields)
escapeFields
- true if fields should be enclosed in double quotes.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |