Package cssutils :: Module codec :: Class StreamWriter |
[hide private]
[frames] | no frames]

# Class StreamWriter

source code

       codecs.Codec --+
                      |
    codecs.StreamWriter --+
                          |
                         StreamWriter

Instance Methods | [hide private]
__init__(self, stream, errors=`'``strict``'`, encoding=None, header=False) Creates a StreamWriter instance. | source code
encode(self, input, errors=`'``strict``'`) Encodes the object input and returns a tuple (output object, length consumed). | source code
_geterrors(self) | source code
_seterrors(self, errors) | source code
Inherited from `codecs.StreamWriter`: `__enter__`, `__exit__`, `__getattr__`, `reset`, `write`, `writelines` Inherited from `codecs.Codec`: `decode`

Properties | [hide private]
| errors

Method Details | [hide private]

### __init__(self, stream, errors=`'``strict``'`, encoding=None, header=False) (Constructor) | source code
    Creates a StreamWriter instance.

    stream must be a file-like object open for writing
    (binary) data.

    The StreamWriter 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
     'xmlcharrefreplace' - Replace with the appropriate XML
                           character reference.
     'backslashreplace'  - Replace with backslashed escape
                           sequences (only for encoding).

    The set of allowed parameter values can be extended via
    register_error.
Overrides: codecs.StreamWriter.__init__ (inherited documentation)

### encode(self, input, errors=`'``strict``'`) | source code
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. Overrides: codecs.Codec.encode (inherited documentation)

Property Details | [hide private]

  ### errors Get Method: cssutils.codec.StreamWriter._geterrors(self) Set Method: cssutils.codec.StreamWriter._seterrors(self, errors) Delete Method:
      None