Top Description Fields Constructors Methods
com.ziclix.python.sql.pipe.csv

public Class CSVSink

extends Object
implements Sink
Class Inheritance
All Implemented Interfaces
com.ziclix.python.sql.pipe.Sink
Imports
com.ziclix.python.sql.pipe.Sink, org.python.core.Py, .PyObject, java.io.PrintWriter

The CSVSink writes data out in a Comma Seperated Format.
Author
brian zimmer

Field Summary

Modifier and TypeField and Description
protected PyObject
converters

Field converters

protected String
delimiter

Field delimiter

protected boolean
header

Field header

protected PrintWriter
writer

Field writer

Constructor Summary

AccessConstructor and Description
public
CSVSink(PrintWriter
the PrintWriter to which data will be written
writer
)

All data will be written to the given PrintWriter.

public
CSVSink(PrintWriter
the PrintWriter to which data will be written
writer
,
PyObject
an indexed dictionary of callable objects used for converting objects to strings
converters
)

All data will be written to the given PrintWriter.

Method Summary

Modifier and TypeMethod and Description
protected String
convert(PyObject index, PyObject object)

Convert the object at index to a String.

public void
end()

Implements com.ziclix.python.sql.pipe.Sink.end.

Method end

protected void
println(String[] row)

Print the row of Strings.

public void
row(PyObject row)

Implements com.ziclix.python.sql.pipe.Sink.row.

Handle the data callback and write the row out.

public void
start()

Implements com.ziclix.python.sql.pipe.Sink.start.

Method start

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

convertersback to summary
protected PyObject converters

Field converters

delimiterback to summary
protected String delimiter

Field delimiter

writerback to summary
protected PrintWriter writer

Field writer

Constructor Detail

CSVSinkback to summary
public CSVSink(PrintWriter writer)

All data will be written to the given PrintWriter.

Parameters
writer:PrintWriter

the PrintWriter to which data will be written

CSVSinkback to summary
public CSVSink(PrintWriter writer, PyObject converters)

All data will be written to the given PrintWriter. If the converters param is not None, then an attempt will be made to convert the object using the given converter.

Parameters
writer:PrintWriter

the PrintWriter to which data will be written

converters:PyObject

an indexed dictionary of callable objects used for converting objects to strings

Method Detail

convertback to summary
protected String convert(PyObject index, PyObject object)

Convert the object at index to a String.

endback to summary
public void end()

Implements com.ziclix.python.sql.pipe.Sink.end.

Method end

printlnback to summary
protected void println(String[] row)

Print the row of Strings.

rowback to summary
public void row(PyObject row)

Implements com.ziclix.python.sql.pipe.Sink.row.

Handle the data callback and write the row out.

startback to summary
public void start()

Implements com.ziclix.python.sql.pipe.Sink.start.

Method start