Revision 1 as of 2007-04-02 22:34:35

Clear message

The Python2.5's codecs.StreamReaderWriter combines StreamReader and StreamWriter.

Pseudocode:

   1 class StreamReaderWriter:
   2     def __init__(self, stream, class_sr, class_sw):
   3         self.r = class_sr(stream)
   4         self.w = class_sw(stream)
   5 
   6     def read(self):
   7         return self.r.read()
   8 
   9     def write(self, data):
  10         return self.w.write(data)

The codecs module defines a function codecs.open(name, encoding) that returns an instance of StreamReaderWriter configured with the supplied encoding.


CategoryUnicode

Unable to edit the page? See the FrontPage for instructions.