uk.org.ogsadai.converters.csv
Class CSVConfigurator

java.lang.Object
  |
  +--uk.org.ogsadai.converters.csv.CSVConfigurator

public class CSVConfigurator
extends java.lang.Object

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:

Author:
The OGSA-DAI Project Team

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

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
See Also:
Constant Field Values

mLineBreakChars

private java.lang.String mLineBreakChars

mLineBreak

private java.lang.String mLineBreak

mDelimiter

private java.lang.String mDelimiter

mNullDataStr

private java.lang.String mNullDataStr

mIncludeHeader

private boolean mIncludeHeader

mEscapeFields

private boolean mEscapeFields
Constructor Detail

CSVConfigurator

public CSVConfigurator()
Method Detail

getMLineBreakChars

public java.lang.String getMLineBreakChars()
Returns proper ASCII representation of lineBreak.

Returns:
ASCII representation of lineBreak

getMLineBreak

public java.lang.String getMLineBreak()
Returns lineBreak.

Returns:
lineBreak

setMLineBreak

public void setMLineBreak(java.lang.String lineBreak)
                   throws CSVConfigurationException
Set the code used to break lines.

Parameters:
lineBreak - Allowed values are: CR (used in UNIX), LF (used in Apple Mac), LFCR (used in Windows)
Throws:
CSVConfigurationException

getMNullDataStr

public java.lang.String getMNullDataStr()
Returns string that is used to signify null data fields

Returns:
string used for null data fields

setMNullDataStr

public void setMNullDataStr(java.lang.String nullDataStr)
                     throws CSVConfigurationException
Set the string that signifies null value fields.

Parameters:
nullDataStr -
Throws:
CSVConfigurationException

isMIncludeHeader

public boolean isMIncludeHeader()
Informs if header line with column names is included.

Returns:
true if header is included

setMIncludeHeader

public void setMIncludeHeader(boolean includeHeader)
Set the field informing about header line inclusion.

Parameters:
includeHeader - true if header is included

getMDelimiter

public java.lang.String getMDelimiter()
Returns string used as delimiter for fields

Returns:
delimiter

setMDelimiter

public void setMDelimiter(java.lang.String delimiter)
                   throws CSVConfigurationException
Set the delimiter used to separate fields.

Parameters:
delimiter - Any single character except double quote can be used as delimiter
Throws:
CSVConfigurationException

isMEscapeFields

public boolean isMEscapeFields()
Informs if textual fields should be enclosed in double quotes

Returns:
true if fileds should be surrounded by double quotes

setMEscapeFields

public void setMEscapeFields(boolean escapeFields)
Set the field informing about if fields should be surrounded by double quotes.

Parameters:
escapeFields - true if fields should be enclosed in double quotes.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object