Back to index

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

List of all members.

Public Member Functions

def __init__
def reset
def getstate
def setstate
def decode

Public Attributes

 decoder
 buffer
 errors
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _buffer_decode

Detailed Description

Definition at line 48 of file utf_32.py.


Constructor & Destructor Documentation

def encodings.utf_32.IncrementalDecoder.__init__ (   self,
  errors = 'strict' 
)
This subclass of IncrementalDecoder can be used as the baseclass for an
incremental decoder if the decoder must be able to handle incomplete
byte sequences.

Reimplemented from codecs.BufferedIncrementalDecoder.

Definition at line 49 of file utf_32.py.

00049 
00050     def __init__(self, errors='strict'):
00051         codecs.BufferedIncrementalDecoder.__init__(self, errors)
00052         self.decoder = None

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def encodings.utf_32.IncrementalDecoder._buffer_decode (   self,
  input,
  errors,
  final 
) [private]

Reimplemented from codecs.BufferedIncrementalDecoder.

Definition at line 53 of file utf_32.py.

00053 
00054     def _buffer_decode(self, input, errors, final):
00055         if self.decoder is None:
00056             (output, consumed, byteorder) = \
00057                 codecs.utf_32_ex_decode(input, errors, 0, final)
00058             if byteorder == -1:
00059                 self.decoder = codecs.utf_32_le_decode
00060             elif byteorder == 1:
00061                 self.decoder = codecs.utf_32_be_decode
00062             elif consumed >= 4:
00063                 raise UnicodeError("UTF-32 stream does not start with BOM")
00064             return (output, consumed)
00065         return self.decoder(input, self.errors, final)

def codecs.BufferedIncrementalDecoder.decode (   self,
  input,
  final = False 
) [inherited]
Decode input and returns the resulting object.

Reimplemented from codecs.IncrementalDecoder.

Definition at line 297 of file codecs.py.

00297 
00298     def decode(self, input, final=False):
00299         # decode input (taking the buffer into account)
00300         data = self.buffer + input
00301         (result, consumed) = self._buffer_decode(data, self.errors, final)
00302         # keep undecoded input until the next call
00303         self.buffer = data[consumed:]
00304         return result

Here is the call graph for this function:

Here is the caller graph for this function:

Return the current state of the decoder.

This must be a (buffered_input, additional_state_info) tuple.
buffered_input must be a bytes object containing bytes that
were passed to decode() that have not yet been converted.
additional_state_info must be a non-negative integer
representing the state of the decoder WITHOUT yet having
processed the contents of buffered_input.  In the initial state
and after reset(), getstate() must return (b"", 0).

Reimplemented from codecs.BufferedIncrementalDecoder.

Definition at line 70 of file utf_32.py.

00070 
00071     def getstate(self):
00072         # additonal state info from the base class must be None here,
00073         # as it isn't passed along to the caller
00074         state = codecs.BufferedIncrementalDecoder.getstate(self)[0]
00075         # additional state info we pass to the caller:
00076         # 0: stream is in natural order for this platform
00077         # 1: stream is in unnatural order
00078         # 2: endianness hasn't been determined yet
00079         if self.decoder is None:
00080             return (state, 2)
00081         addstate = int((sys.byteorder == "big") !=
00082                        (self.decoder is codecs.utf_32_be_decode))
00083         return (state, addstate)

Here is the call graph for this function:

Reset the decoder to the initial state.

Reimplemented from codecs.BufferedIncrementalDecoder.

Definition at line 66 of file utf_32.py.

00066 
00067     def reset(self):
00068         codecs.BufferedIncrementalDecoder.reset(self)
00069         self.decoder = None

Here is the call graph for this function:

Here is the caller graph for this function:

def encodings.utf_32.IncrementalDecoder.setstate (   self,
  state 
)
Set the current state of the decoder.

state must have been returned by getstate().  The effect of
setstate((b"", 0)) must be equivalent to reset().

Reimplemented from codecs.BufferedIncrementalDecoder.

Definition at line 84 of file utf_32.py.

00084 
00085     def setstate(self, state):
00086         # state[1] will be ignored by BufferedIncrementalDecoder.setstate()
00087         codecs.BufferedIncrementalDecoder.setstate(self, state)
00088         state = state[1]
00089         if state == 0:
00090             self.decoder = (codecs.utf_32_be_decode
00091                             if sys.byteorder == "big"
00092                             else codecs.utf_32_le_decode)
00093         elif state == 1:
00094             self.decoder = (codecs.utf_32_le_decode
00095                             if sys.byteorder == "big"
00096                             else codecs.utf_32_be_decode)
00097         else:
00098             self.decoder = None

Here is the call graph for this function:


Member Data Documentation

Definition at line 290 of file codecs.py.

Definition at line 51 of file utf_32.py.

Create a IncrementalDecoder instance.

The IncrementalDecoder 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.IncrementalDecoder, encodings.zlib_codec.IncrementalDecoder, encodings.base64_codec.IncrementalDecoder, and encodings.hex_codec.IncrementalDecoder.

Definition at line 246 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: