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

public Class PyReader

extends PyIterator
Class Inheritance
Annotations
@ExposedType
name:_csv.reader
doc:CSV reader Reader objects are responsible for reading and parsing tabular data in CSV format.
Imports
org.python.core.PyIterator, .PyList, .PyObject, .PyString, .PyType, .Visitproc, org.python.expose.ExposedGet, .ExposedType

CSV file reader. Analogous to CPython's _csv.c::ReaderObj struct.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
PyReader.ParserState

State of the CSV reader.

Field Summary

Modifier and TypeField and Description
public PyDialect
dialect

Parsing Dialect.

private StringBuffer
field

Current field builder in here.

private PyList
fields

Field list for current record.

private static final int
INITIAL_BUILDER_CAPACITY

Initial capacity of the field StringBuilder.

private PyObject
input_iter

The underlying input iterator.

public int
line_num

The current line number.

private boolean
numeric_field

Whether the field should be treated as numeric.

public static final String
private PyReader.ParserState
state

Current CSV parse state.

public static final PyType
Inherited from org.python.core.PyIterator:
__doc__nextstopException

Constructor Summary

AccessConstructor and Description
public
PyReader(PyObject input_iter, PyDialect dialect)

Method Summary

Modifier and TypeMethod and Description
public PyObject
__iternext__()

Implements abstract org.python.core.PyIterator.__iternext__.

Return the next element of the sequence that this is an iterator for.

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

Overrides org.python.core.PyIterator.traverse.

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

Inherited from org.python.core.PyIterator:
__iter____tojava__doNextiteratornext

Field Detail

dialectback to summary
public PyDialect dialect

Parsing Dialect.

Annotations
@ExposedGet

fieldback to summary
private StringBuffer field

Current field builder in here.

fieldsback to summary
private PyList fields

Field list for current record.

INITIAL_BUILDER_CAPACITYback to summary
private static final int INITIAL_BUILDER_CAPACITY

Initial capacity of the field StringBuilder.

input_iterback to summary
private PyObject input_iter

The underlying input iterator.

line_numback to summary
public int line_num

The current line number.

Annotations
@ExposedGet

numeric_fieldback to summary
private boolean numeric_field

Whether the field should be treated as numeric.

reader_docback to summary
public static final String reader_doc
stateback to summary
private PyReader.ParserState state

Current CSV parse state.

TYPEback to summary
public static final PyType TYPE

Hides org.python.core.PyObject.TYPE.

Constructor Detail

PyReaderback to summary
public PyReader(PyObject input_iter, PyDialect dialect)

Method Detail

__iternext__back to summary
public PyObject __iternext__()

Implements abstract org.python.core.PyIterator.__iternext__.

Doc from org.python.core.PyObject.__iternext__.

Return the next element of the sequence that this is an iterator for. Returns null when the end of the sequence is reached.

parse_add_charback to summary
private void parse_add_char(char c)
parse_process_charback to summary
private void parse_process_char(char c)
Annotations
@SuppressWarnings:fallthrough
parse_resetback to summary
private void parse_reset()
parse_save_fieldback to summary
private void parse_save_field()
refersDirectlyToback to summary
public boolean refersDirectlyTo(PyObject ob)

Overrides org.python.core.PyIterator.refersDirectlyTo.

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)

Overrides org.python.core.PyIterator.traverse.

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
org.python.modules._csv back to summary

private final Enum PyReader.ParserState

extends Enum<PyReader.ParserState>
Class Inheritance

State of the CSV reader.

Field Summary

Modifier and TypeField and Description
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState
public static final PyReader.ParserState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static PyReader.ParserState
public static PyReader.ParserState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

EAT_CRNLback to summary
public static final PyReader.ParserState EAT_CRNL
ESCAPE_IN_QUOTED_FIELDback to summary
public static final PyReader.ParserState ESCAPE_IN_QUOTED_FIELD
ESCAPED_CHARback to summary
public static final PyReader.ParserState ESCAPED_CHAR
IN_FIELDback to summary
public static final PyReader.ParserState IN_FIELD
IN_QUOTED_FIELDback to summary
public static final PyReader.ParserState IN_QUOTED_FIELD
QUOTE_IN_QUOTED_FIELDback to summary
public static final PyReader.ParserState QUOTE_IN_QUOTED_FIELD
START_FIELDback to summary
public static final PyReader.ParserState START_FIELD
START_RECORDback to summary
public static final PyReader.ParserState START_RECORD

Constructor Detail

ParserStateback to summary
private ParserState()

Method Detail

valueOfback to summary
public static PyReader.ParserState valueOf(String name)
valuesback to summary
public static PyReader.ParserState[] values()