Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
codecs.BufferedIncrementalEncoder Class Reference
Inheritance diagram for codecs.BufferedIncrementalEncoder:
Inheritance graph
[legend]
Collaboration diagram for codecs.BufferedIncrementalEncoder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def encode
def reset
def getstate
def setstate

Public Attributes

 buffer
 errors
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _buffer_encode

Detailed Description

This subclass of IncrementalEncoder can be used as the baseclass for an
incremental encoder if the encoder must keep some of the output in a
buffer between calls to encode().

Definition at line 198 of file codecs.py.


Constructor & Destructor Documentation

def codecs.BufferedIncrementalEncoder.__init__ (   self,
  errors = 'strict' 
)
This subclass of IncrementalEncoder can be used as the baseclass for an
incremental encoder if the encoder must keep some of the output in a
buffer between calls to encode().

Reimplemented from codecs.IncrementalEncoder.

Definition at line 204 of file codecs.py.

00204 
00205     def __init__(self, errors='strict'):
00206         IncrementalEncoder.__init__(self, errors)
00207         # unencoded input that is kept between calls to encode()
00208         self.buffer = ""

Here is the caller graph for this function:


Member Function Documentation

def codecs.BufferedIncrementalEncoder._buffer_encode (   self,
  input,
  errors,
  final 
) [private]

Reimplemented in encodings.idna.IncrementalEncoder.

Definition at line 209 of file codecs.py.

00209 
00210     def _buffer_encode(self, input, errors, final):
00211         # Overwrite this method in subclasses: It must encode input
00212         # and return an (output, length consumed) tuple
00213         raise NotImplementedError

Here is the caller graph for this function:

def codecs.BufferedIncrementalEncoder.encode (   self,
  input,
  final = False 
)
Encodes input and returns the resulting object.

Reimplemented from codecs.IncrementalEncoder.

Definition at line 214 of file codecs.py.

00214 
00215     def encode(self, input, final=False):
00216         # encode input (taking the buffer into account)
00217         data = self.buffer + input
00218         (result, consumed) = self._buffer_encode(data, self.errors, final)
00219         # keep unencoded input until the next call
00220         self.buffer = data[consumed:]
00221         return result

Here is the call graph for this function:

Here is the caller graph for this function:

Return the current state of the encoder.

Reimplemented from codecs.IncrementalEncoder.

Definition at line 226 of file codecs.py.

00226 
00227     def getstate(self):
00228         return self.buffer or 0

Resets the encoder to the initial state.

Reimplemented from codecs.IncrementalEncoder.

Definition at line 222 of file codecs.py.

00222 
00223     def reset(self):
00224         IncrementalEncoder.reset(self)
00225         self.buffer = ""

Here is the caller graph for this function:

def codecs.BufferedIncrementalEncoder.setstate (   self,
  state 
)
Set the current state of the encoder. state must have been
returned by getstate().

Reimplemented from codecs.IncrementalEncoder.

Definition at line 229 of file codecs.py.

00229 
00230     def setstate(self, state):
00231         self.buffer = state or ""


Member Data Documentation

Reimplemented from codecs.IncrementalEncoder.

Definition at line 207 of file codecs.py.

Creates an IncrementalEncoder instance.

The IncrementalEncoder may use different error handling schemes by
providing the errors keyword argument. See the module docstring
for a list of possible values.

Reimplemented in encodings.bz2_codec.IncrementalEncoder, encodings.zlib_codec.IncrementalEncoder, encodings.base64_codec.IncrementalEncoder, and encodings.hex_codec.IncrementalEncoder.

Definition at line 172 of file codecs.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: