Package RDFCalendar :: Module Parsers :: Class Reader
[show private | hide private]
[frames | no frames]

Class Reader


A simple class wrapping a file, providing simple pushback capabilities.

Method Summary
  __init__(self, f, non_standard_newline)
Initialise the object with the file 'f'.
  pushback(self, line)
Push the given 'line' back so that the next line read is actually the given 'line' and not the next line from the underlying file.
  read_until(self, targets)
Read from the stream until one of the 'targets' is seen.
  readline(self)
If no pushed-back lines exist, read a line directly from the file.

Method Details

__init__(self, f, non_standard_newline=0)
(Constructor)

Initialise the object with the file 'f'. If 'non_standard_newline' is
set to a true value (unlike the default), lines ending with CR will be
treated as complete lines.

pushback(self, line)

Push the given 'line' back so that the next line read is actually the
given 'line' and not the next line from the underlying file.

read_until(self, targets)

Read from the stream until one of the 'targets' is seen. Return the
string from the current position up to the target found, along with the
target string, using a tuple of the form (string, target). If no target
was found, return the entire string together with a target of None.

readline(self)

If no pushed-back lines exist, read a line directly from the file.
Otherwise, read from the list of pushed-back lines.

Generated by Epydoc 2.1 on Sat Jul 7 19:42:53 2007 http://epydoc.sf.net