Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
Codec Class Reference

Codec base classes (defining the API) More...

Inheritance diagram for Codec:
StreamReader StreamWriter

Public Member Functions

def encode
 
def decode
 

Detailed Description

Codec base classes (defining the API)

Defines the interface for stateless encoders/decoders.

    The .encode()/.decode() methods may implement different error
    handling schemes by providing the errors argument. These
    string values are defined:

     'strict' - raise a ValueError error (or a subclass)
     'ignore' - ignore the character and continue with the next
     'replace' - replace with a suitable replacement character;
                Python will use the official U+FFFD REPLACEMENT
                CHARACTER for the builtin Unicode codecs.

Definition at line 48 of file codecs.py.

Member Function Documentation

def decode (   self,
  input,
  errors = 'strict' 
)
Decodes the object input and returns a tuple (output
    object, length consumed).

    input must be an object which provides the bf_getreadbuf
    buffer slot. Python strings, buffer objects and memory
    mapped files are examples of objects providing this slot.

    errors defines the error handling to apply. It defaults to
    'strict' handling.

    The method may not store state in the Codec instance. Use
    StreamCodec for codecs which have to keep state in order to
    make encoding/decoding efficient.

    The decoder must be able to handle zero length input and
    return an empty object of the output object type in this
    situation.

Definition at line 82 of file codecs.py.

82 
83  def decode(self, input, errors='strict'):
84 
85  """ Decodes the object input and returns a tuple (output
86  object, length consumed).
87 
88  input must be an object which provides the bf_getreadbuf
89  buffer slot. Python strings, buffer objects and memory
90  mapped files are examples of objects providing this slot.
91 
92  errors defines the error handling to apply. It defaults to
93  'strict' handling.
94 
95  The method may not store state in the Codec instance. Use
96  StreamCodec for codecs which have to keep state in order to
97  make encoding/decoding efficient.
98 
99  The decoder must be able to handle zero length input and
100  return an empty object of the output object type in this
101  situation.
102 
103  """
104  raise NotImplementedError
105 
106 #
107 # The StreamWriter and StreamReader class provide generic working
108 # interfaces which can be used to implement new encoding submodules
109 # very easily. See encodings/utf_8.py for an example on how this is
110 # done.
111 #
def encode (   self,
  input,
  errors = 'strict' 
)
Encodes the object input and returns a tuple (output
    object, length consumed).

    errors defines the error handling to apply. It defaults to
    'strict' handling.

    The method may not store state in the Codec instance. Use
    StreamCodec for codecs which have to keep state in order to
    make encoding/decoding efficient.

    The encoder must be able to handle zero length input and
    return an empty object of the output object type in this
    situation.

Definition at line 63 of file codecs.py.

63 
64  def encode(self, input, errors='strict'):
65 
66  """ Encodes the object input and returns a tuple (output
67  object, length consumed).
68 
69  errors defines the error handling to apply. It defaults to
70  'strict' handling.
71 
72  The method may not store state in the Codec instance. Use
73  StreamCodec for codecs which have to keep state in order to
74  make encoding/decoding efficient.
75 
76  The encoder must be able to handle zero length input and
77  return an empty object of the output object type in this
78  situation.
79 
80  """
81  raise NotImplementedError

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