uk.org.ogsadai.converters.resultset.csv
Class TextColumnStrategy

java.lang.Object
  |
  +--uk.org.ogsadai.converters.resultset.csv.TextColumnStrategy
All Implemented Interfaces:
ColumnStrategy

public class TextColumnStrategy
extends java.lang.Object
implements ColumnStrategy

Strategy to retrieve a text value from the database.

Author:
The OGSA-DAI Team.

Field Summary
private static char[] charBuffer
           
private static int charBufferSize
           
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  CSVConfigurator mConfigurator
          Configurator object defining CSV file format
 
Constructor Summary
TextColumnStrategy(CSVConfigurator configurator)
          Constructs strategy for textual fields.
 
Method Summary
 void convertField(java.lang.StringBuffer output, java.sql.ResultSet rs, int column)
          Convert a single field from the current row of the result set into string and appends them to the output string buffer.
private  java.lang.String prepareField(java.lang.String input)
          Searches for double quotes in input string and returns a string with each double quote escaped by preceeding double quote.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mConfigurator

private CSVConfigurator mConfigurator
Configurator object defining CSV file format


charBuffer

private static char[] charBuffer

charBufferSize

private static int charBufferSize
Constructor Detail

TextColumnStrategy

public TextColumnStrategy(CSVConfigurator configurator)
Constructs strategy for textual fields.

Parameters:
configurator - that defines CSV file format.
Method Detail

convertField

public void convertField(java.lang.StringBuffer output,
                         java.sql.ResultSet rs,
                         int column)
                  throws java.sql.SQLException,
                         java.io.IOException
Description copied from interface: ColumnStrategy
Convert a single field from the current row of the result set into string and appends them to the output string buffer.

Specified by:
convertField in interface ColumnStrategy
Parameters:
output - output stream to write the converted bytes
rs - result set containing the field
column - index of the column within the current row containing the field
Throws:
java.sql.SQLException - if a database error occurs during the processing of the result set
java.io.IOException - if there is an error with accessing streams used in conversion

prepareField

private java.lang.String prepareField(java.lang.String input)
Searches for double quotes in input string and returns a string with each double quote escaped by preceeding double quote.

Parameters:
input - string
Returns:
string with escaped double quotes