Top Description Fields Constructors Methods
org.python.modules._csv

public Class PyWriter

extends PyObject
implements Traverseproc
Class Inheritance
All Implemented Interfaces
org.python.core.Traverseproc
Annotations
@ExposedType
name:_csv.writer
doc:CSV writer Writer objects are responsible for generating tabular data in CSV format from sequence input.
Imports
org.python.core.Py, .PyException, .PyFloat, .PyObject, .PyString, .PyType, .PyUnicode, .Traverseproc, .Visitproc, org.python.expose.ExposedType, .ExposedMethod, .ExposedGet

CSV file writer. Analogous to CPython's _csv.c::WriterObj struct.

Field Summary

Modifier and TypeField and Description
public static PyString
public static PyString
public PyDialect
dialect

Parsing dialect.

private int
num_fields

Number of fields in record.

private boolean
quoted

Whether field should be quoted during a join.

private StringBuffer
rec

Buffer for parser.join.

private int
rec_len

Length of record.

public static final PyType
private PyObject
writeline

Output lines writer callable.

public static final String
Inherited from org.python.core.PyObject:
attributesgcMonitorGlobalobjtype

Constructor Summary

AccessConstructor and Description
public
PyWriter(PyObject writeline, PyDialect dialect)

Method Summary

Modifier and TypeMethod and Description
private void
addChar(char c, boolean copy_phase)

private boolean
join_append(String field, boolean quote_empty)

private int
join_append_data(String field, boolean quote_empty, boolean copy_phase)

This method behaves differently depending on the value of copy_phase: if copy_phase is false, then the method determines the new record length.

private boolean
private void
public boolean
public int
traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

pack-priv final boolean
pack-priv final void
public boolean
public void
Inherited from org.python.core.PyObject:
__abs____add____and____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____call____cmp____coerce____coerce_ex____complex____contains____delattr____delattr____delete____delitem____delitem____delslice____delslice____dir____div____divmod____ensure_finalizer____eq____findattr____findattr____findattr_ex____finditem____finditem____finditem____float____floordiv____format____ge____get____getattr____getattr____getitem____getitem____getnewargs____getslice____getslice____gt____hash____hex____iadd____iand____idiv____idivmod____ifloordiv____ilshift____imod____imul____index____int____invert____ior____ipow____irshift____isub____iter____iternext____itruediv____ixor____le____len____long____lshift____lt____mod____mul____ne____neg____nonzero____not____oct____or____pos____pow____pow____radd____rand____rawdir____rdiv____rdivmod____reduce____reduce_ex____reduce_ex____repr____rfloordiv____rlshift____rmod____rmul____ror____rpow____rrshift____rshift____rsub____rtruediv____rxor____set____setattr____setattr____setitem____setitem____setitem____setslice____setslice____str____sub____tojava____truediv____trunc____unicode____xor___add_and_callextra_cmp_div_divmod_doget_doget_doset_eq_floordiv_ge_gt_iadd_iand_idiv_idivmod_ifloordiv_ilshift_imod_imul_in_ior_ipow_irshift_is_isnot_isub_itruediv_ixor_jcall_jcallexc_jthrow_le_lshift_lt_mod_mul_ne_notin_or_pow_rshift_sub_truediv_unsupportedop_xoradaptToCoerceTupleasDoubleasIndexasIndexasIntasIntasIterableasLongasLongasNameasNameasStringasStringasStringOrNullasStringOrNullbit_lengthconjugatedelDictdelTypedispatch__init__equalsfastGetClassfastGetDictfinalizegetDictgetJavaProxygetTypehashCodeimpAttrimplementsDescrDeleteimplementsDescrGetimplementsDescrSetinvokeinvokeinvokeinvokeinvokeinvokeisCallableisDataDescrisIndexisIntegerisMappingTypeisNumberTypeisSequenceTypemergeClassDictmergeDictAttrmergeListAttrnoAttributeErrorobject___subclasshook__readonlyAttributeErrorrunsupportedopMessagesetDictsetTypetoStringunsupportedopMessage

Field Detail

__doc__writerowback to summary
public static PyString __doc__writerow
__doc__writerowsback to summary
public static PyString __doc__writerows
dialectback to summary
public PyDialect dialect

Parsing dialect.

Annotations
@ExposedGet

num_fieldsback to summary
private int num_fields

Number of fields in record.

quotedback to summary
private boolean quoted

Whether field should be quoted during a join.

recback to summary
private StringBuffer rec

Buffer for parser.join.

rec_lenback to summary
private int rec_len

Length of record.

TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

writelineback to summary
private PyObject writeline

Output lines writer callable.

writer_docback to summary
public static final String writer_doc

Constructor Detail

PyWriterback to summary
public PyWriter(PyObject writeline, PyDialect dialect)

Method Detail

addCharback to summary
private void addChar(char c, boolean copy_phase)
join_appendback to summary
private boolean join_append(String field, boolean quote_empty)
join_append_databack to summary
private int join_append_data(String field, boolean quote_empty, boolean copy_phase)

This method behaves differently depending on the value of copy_phase: if copy_phase is false, then the method determines the new record length. If copy_phase is true then the new field is appended to the record.

join_append_lineterminatorback to summary
private boolean join_append_lineterminator()
join_resetback to summary
private void join_reset()
refersDirectlyToback to summary
public boolean refersDirectlyTo(PyObject ob)

Implements org.python.core.Traverseproc.refersDirectlyTo.

Doc from org.python.core.Traverseproc.refersDirectlyTo.

Optional operation. Should only be implemented if it is more efficient than calling traverse(Visitproc, Object) with a visitproc that just watches out for ob. Must return false if ob is null.

Annotations
@Override
traverseback to summary
public int traverse(Visitproc visit, Object arg)

Implements org.python.core.Traverseproc.traverse.

Doc from org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects. Like in CPython, arg must be passed unmodified to visit as its second parameter. If Visitproc#visit(PyObject, Object) returns nonzero, this return value must be returned immediately by traverse. Visitproc#visit(PyObject, Object) must not be called with a null PyObject-argument.

Annotations
@Override
writer_writerowback to summary
pack-priv final boolean writer_writerow(PyObject seq)
Annotations
@ExposedMethod
writer_writerowsback to summary
pack-priv final void writer_writerows(PyObject seqseq)
Annotations
@ExposedMethod
writerowback to summary
public boolean writerow(PyObject seq)
writerowsback to summary
public void writerows(PyObject seqseq)