com.sas.storage.jdbc.export
Class RelationalDelimitedValuesExporter

com.sas.storage.jdbc.export.RelationalDelimitedValuesExporter
All Implemented Interfaces:
RelationalExportInterface

public class RelationalDelimitedValuesExporter
implements RelationalExportInterface

Exporter class that tranforms non multidimensional data into delimited values data streams like Comma Separated Values streams or Tab Separated Values streams. By default it generates a CSV stream, to produce a different delimited values stream either use the RelationalDelimitedValuesExporter(String) constructor or set the dataDelimiter and the lineDelimiter attributes by calling the setDataDelimiter(String) and the setLineDelimiter(String) methods respectively.

Since:
3.1

Constructor Summary
RelationalDelimitedValuesExporter()
          Creates a new RelationalDelimitedValuesExporter object using ExportDelimiters.COMMA as dataDelimiter and ExportDelimiters.CARRIAGE_RETURN as lineDelimiter.
RelationalDelimitedValuesExporter(java.lang.String dataDelimiter)
          Creates a new RelationalDelimitedValuesExporter object using the specified dataDelimiter and ExportDelimiters.CARRIAGE_RETURN as lineDelimiter.
 
Method Summary
 java.lang.String getColumnHeaderLine(java.lang.Object[] columnHeaders)
          Generates a string containing the values of the column headers to export.
 java.lang.String getDataDelimiter()
          Returns the string used to delimit the data values.
 java.lang.String getFileHeader()
          Returns what is used as the header of the exported file.
 java.lang.String getFileTrailer()
          Returns what is used as the trailer of the exported file.
 java.lang.String getLine(java.lang.Object rowHeader, java.lang.Object[] data)
          Generates a string containing the values of the rowHeader (if not null) followed by the values of the data to export.
 java.lang.String getLineDelimiter()
          Returns the string used to delimit the lines of values.
protected  java.lang.String objectToString(java.lang.Object value)
          Transforms an Object into a String.
 void setDataDelimiter(java.lang.String dataDelimiter)
          Sets the string used to delimit the data values.
 void setLineDelimiter(java.lang.String lineDelimiter)
          Sets the string used to delimit the lines of values.
protected  void writeString(java.lang.String str, java.lang.StringBuffer line)
          Writes a string into a StringBuffer, checking for embedded double quotes.
 

Constructor Detail

RelationalDelimitedValuesExporter

public RelationalDelimitedValuesExporter()
Creates a new RelationalDelimitedValuesExporter object using ExportDelimiters.COMMA as dataDelimiter and ExportDelimiters.CARRIAGE_RETURN as lineDelimiter.


RelationalDelimitedValuesExporter

public RelationalDelimitedValuesExporter(java.lang.String dataDelimiter)
Creates a new RelationalDelimitedValuesExporter object using the specified dataDelimiter and ExportDelimiters.CARRIAGE_RETURN as lineDelimiter.

Parameters:
dataDelimiter - The string that delimits the data values.
Method Detail

getDataDelimiter

public java.lang.String getDataDelimiter()
Returns the string used to delimit the data values.

Returns:
String The string used to delimit the data values.
See Also:
ExportDelimiters.COMMA, ExportDelimiters.TAB

setDataDelimiter

public void setDataDelimiter(java.lang.String dataDelimiter)
Sets the string used to delimit the data values.

Parameters:
dataDelimiter - The string used to delimit the data values. Example of valid values are: ExportDelimiters.COMMA and ExportDelimiters.TAB

getLineDelimiter

public java.lang.String getLineDelimiter()
Returns the string used to delimit the lines of values.

Returns:
String The string used to delimit the lines of values.
See Also:
ExportDelimiters.CARRIAGE_RETURN

setLineDelimiter

public void setLineDelimiter(java.lang.String lineDelimiter)
Sets the string used to delimit the lines of values.

Parameters:
lineDelimiter - The string used to delimit the lines of values. An example of line delimiter is ExportDelimiters.CARRIAGE_RETURN

writeString

protected void writeString(java.lang.String str,
                           java.lang.StringBuffer line)
Writes a string into a StringBuffer, checking for embedded double quotes.

Parameters:
str - The string to write.
line - The StringBuffer to fill.

objectToString

protected java.lang.String objectToString(java.lang.Object value)
Transforms an Object into a String.

Parameters:
value - The object to transform.
Returns:
String The transformed object.

getFileHeader

public java.lang.String getFileHeader()
Description copied from interface: RelationalExportInterface
Returns what is used as the header of the exported file.

Specified by:
getFileHeader in interface RelationalExportInterface
Returns:
String The header of the exported file.

getColumnHeaderLine

public java.lang.String getColumnHeaderLine(java.lang.Object[] columnHeaders)
Description copied from interface: RelationalExportInterface
Generates a string containing the values of the column headers to export.

Specified by:
getColumnHeaderLine in interface RelationalExportInterface
Parameters:
columnHeaders - The column header objects.
Returns:
String The values of the column headers to export.

getLine

public java.lang.String getLine(java.lang.Object rowHeader,
                                java.lang.Object[] data)
Description copied from interface: RelationalExportInterface
Generates a string containing the values of the rowHeader (if not null) followed by the values of the data to export.

Specified by:
getLine in interface RelationalExportInterface
Parameters:
rowHeader - The object holding the row header value.
data - The object holding the data values.
Returns:
String The string containing the values of the rowHeader followed by the values of the data to export.

getFileTrailer

public java.lang.String getFileTrailer()
Description copied from interface: RelationalExportInterface
Returns what is used as the trailer of the exported file.

Specified by:
getFileTrailer in interface RelationalExportInterface
Returns:
String The trailer of the exported file.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.