Merged revisions 81656 via svnmerge from
[python/dscho.git] / Lib / encodings / utf_16_le.py
blobec454142eedf251e31eab481a1cbea6424273a0a
1 """ Python 'utf-16-le' Codec
4 Written by Marc-Andre Lemburg (mal@lemburg.com).
6 (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
8 """
9 import codecs
11 ### Codec APIs
13 encode = codecs.utf_16_le_encode
15 def decode(input, errors='strict'):
16 return codecs.utf_16_le_decode(input, errors, True)
18 class IncrementalEncoder(codecs.IncrementalEncoder):
19 def encode(self, input, final=False):
20 return codecs.utf_16_le_encode(input, self.errors)[0]
22 class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
23 _buffer_decode = codecs.utf_16_le_decode
25 class StreamWriter(codecs.StreamWriter):
26 encode = codecs.utf_16_le_encode
28 class StreamReader(codecs.StreamReader):
29 decode = codecs.utf_16_le_decode
31 ### encodings module API
33 def getregentry():
34 return codecs.CodecInfo(
35 name='utf-16-le',
36 encode=encode,
37 decode=decode,
38 incrementalencoder=IncrementalEncoder,
39 incrementaldecoder=IncrementalDecoder,
40 streamreader=StreamReader,
41 streamwriter=StreamWriter,