CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 24 Jul 2025 15:57:18 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20071208102702
location: https://web.archive.org/web/20071208102702/https://wiki.python.org/moin/StreamRecoder
server-timing: captures_list;dur=0.713630, exclusion.robots;dur=0.029529, exclusion.robots.policy;dur=0.013594, esindex;dur=0.012539, cdx.remote;dur=62.641403, LoadShardBlock;dur=1036.726089, PetaboxLoader3.resolve;dur=632.332066, PetaboxLoader3.datanode;dur=302.030023
x-app-server: wwwb-app203
x-ts: 302
x-tr: 1143
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: SERVER=wwwb-app203; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 24 Jul 2025 15:57:19 GMT
content-type: text/html;charset=utf-8
x-archive-orig-date: Sat, 08 Dec 2007 10:27:01 GMT
x-archive-orig-server: Apache/2.0.54 (Debian GNU/Linux) mod_fastcgi/2.4.2
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 08 Dec 2007 10:27:02 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 08 Dec 2007 10:27:02 GMT", ; rel="memento"; datetime="Sat, 08 Dec 2007 10:27:02 GMT", ; rel="next memento"; datetime="Fri, 24 Jun 2022 15:01:25 GMT", ; rel="last memento"; datetime="Tue, 25 Jun 2024 20:55:30 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_1_20071208084132_crawl105-c/52_1_20071208102225_crawl107.arc.gz
server-timing: captures_list;dur=0.596065, exclusion.robots;dur=0.021018, exclusion.robots.policy;dur=0.008661, esindex;dur=0.012152, cdx.remote;dur=84.414024, LoadShardBlock;dur=580.483036, PetaboxLoader3.resolve;dur=512.491986, PetaboxLoader3.datanode;dur=281.270122, load_resource;dur=247.945812
x-app-server: wwwb-app203
x-ts: 200
x-tr: 972
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
StreamRecoder - PythonInfo Wiki
StreamRecoder
The codecs.StreamRecoder class re-encodes data between 2 character sets. Its constructor expects the information on 2 character sets in different forms. The user should specify the internal character set as a pair of encoder and decoder. She should provide the external character set by supplying class definitions of a codec-specific StreamReader and StreamWriter.
Pseudocode of codecs.StreamRecoder of the Python2.5 version:
1 class StreamRecoder:
2 def __init__(self, stream, e, d, class_sr, class_sw):
3 # internal encoder, decoder^ ^external decoder, encoder
4 self.r = class_sr(stream)
5 self.w = class_sw(stream)
6 ...
7
8 def read(self):
9 return self.e(self.r.read())
10
11 def write(self, data):
12 return self.w.write(self.d(data))
The codecs module defines a function codecs.EncodedFile() that will return an instance of StreamRecoder according to the supplied internal and external character sets.
See also: StreamReader, StreamWriter, StreamReaderWriter.
EditText (last edited 2007-04-02 22:42:31 by IlguizLatypov)
DeleteCache (cached 2007-09-01 22:08:49)- Login
- Navigation
- Actions
- Your recent pages