def codecs.StreamReader.__init__ |
( |
|
self, |
|
|
|
stream, |
|
|
|
errors = 'strict' |
|
) |
| |
Creates a StreamReader instance.
stream must be a file-like object open for reading
(binary) data.
The StreamReader may use different error handling
schemes by providing the errors keyword argument. These
parameters are predefined:
'strict' - raise a ValueError (or a subclass)
'ignore' - ignore the character and continue with the next
'replace'- replace with a suitable replacement character;
The set of allowed parameter values can be extended via
register_error.
def codecs.StreamReader.__enter__ |
( |
|
self | ) |
|
def codecs.StreamReader.__exit__ |
( |
|
self, |
|
|
|
type, |
|
|
|
value, |
|
|
|
tb |
|
) |
| |
def codecs.StreamReader.__getattr__ |
( |
|
self, |
|
|
|
name, |
|
|
|
getattr = getattr |
|
) |
| |
Inherit all other methods from the underlying stream.
def codecs.StreamReader.__iter__ |
( |
|
self | ) |
|
def codecs.StreamReader.decode |
( |
|
self, |
|
|
|
input, |
|
|
|
errors = 'strict' |
|
) |
| |
def codecs.StreamReader.next |
( |
|
self | ) |
|
Return the next decoded line from the input stream.
def codecs.StreamReader.read |
( |
|
self, |
|
|
|
size = -1 , |
|
|
|
chars = -1 , |
|
|
|
firstline = False |
|
) |
| |
Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of characters to read from the
stream. read() will never return more than chars
characters, but it might return less, if there are not enough
characters available.
size indicates the approximate maximum number of bytes to
read from the stream for decoding purposes. The decoder
can modify this setting as appropriate. The default value
-1 indicates to read and decode as much as possible. size
is intended to prevent having to decode huge files in one
step.
If firstline is true, and a UnicodeDecodeError happens
after the first line terminator in the input only the first line
will be returned, the rest of the input will be kept until the
next call to read().
The method should use a greedy read strategy meaning that
it should read as much data as is allowed within the
definition of the encoding and the given size, e.g. if
optional encoding endings or state markers are available
on the stream, these should be read too.
def codecs.StreamReader.readline |
( |
|
self, |
|
|
|
size = None , |
|
|
|
keepends = True |
|
) |
| |
Read one line from the input stream and return the
decoded data.
size, if given, is passed as size argument to the
read() method.
def codecs.StreamReader.readlines |
( |
|
self, |
|
|
|
sizehint = None , |
|
|
|
keepends = True |
|
) |
| |
Read all lines available on the input stream
and return them as list of lines.
Line breaks are implemented using the codec's decoder
method and are included in the list entries.
sizehint, if given, is ignored since there is no efficient
way to finding the true end-of-line.
def codecs.StreamReader.reset |
( |
|
self | ) |
|
Resets the codec buffers used for keeping state.
Note that no stream repositioning should take place.
This method is primarily intended to be able to recover
from decoding errors.
def codecs.StreamReader.seek |
( |
|
self, |
|
|
|
offset, |
|
|
|
whence = 0 |
|
) |
| |
Set the input stream's current position.
Resets the codec buffers used for keeping state.
codecs.StreamReader.bytebuffer |
codecs.StreamReader.charbuffer |
codecs.StreamReader.errors |
codecs.StreamReader.linebuffer |
codecs.StreamReader.stream |
The documentation for this class was generated from the following file:
Copyright 2014 Google Inc. All rights reserved.