class codecs.IncrementalEncoder(errors='strict')
Constructor for an IncrementalEncoder
instance.
All incremental encoders must provide this constructor interface. They are free to add additional keyword arguments, but only the ones defined here are used by the Python codec registry.
The IncrementalEncoder
may implement different error handling schemes by providing the errors keyword argument. See Error Handlers for possible values.
The errors argument will be assigned to an attribute of the same name. Assigning to this attribute makes it possible to switch between different error handling strategies during the lifetime of the IncrementalEncoder
object.
-
encode(object[, final])
-
Encodes object (taking the current state of the encoder into account) and returns the resulting encoded object. If this is the last call to
encode()
final must be true (the default is false).
-
reset()
-
Reset the encoder to the initial state. The output is discarded: call
.encode(object, final=True)
, passing an empty byte or text string if necessary, to reset the encoder and to get the output.
Please login to continue.