mò
­fIc           @   sl   d  Z  d k Z d k Z e i Z d d „ Z d e i f d „  ƒ  YZ d e i f d „  ƒ  YZ d „  Z d S(	   s‚    Python 'utf-16' Codec


Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

Nt   strictc         C   s   t  i |  | t ƒ S(   N(   t   codecst   utf_16_decodet   inputt   errorst   True(   R   R   (    (    t-   /mit/python/lib/python2.4/encodings/utf_16.pyt   decode   s    t   StreamWriterc           B   s    t  Z d d „ Z d d „ Z RS(   NR    c         C   s#   t  |  _ t i i |  | | ƒ d  S(   N(   t   Falset   selft   bom_writtenR   R   t   __init__t   streamR   (   R
   R   R   (    (    R   R      s    	c         C   sK   t  |  _ t i | | ƒ } t i	 d j o t i
 |  _ n t i |  _ | S(   Nt   little(   R   R
   R   R   t   utf_16_encodeR   R   t   resultt   syst	   byteordert   utf_16_le_encodet   encodet   utf_16_be_encode(   R
   R   R   R   (    (    R   R      s    	(   t   __name__t
   __module__R   R   (    (    (    R   R      s   t   StreamReaderc           B   s   t  Z d „  Z d d „ Z RS(   Nc         C   s4   t  i i |  ƒ y
 |  ` Wn t j
 o n Xd  S(   N(   R   R   t   resetR
   R   t   AttributeError(   R
   (    (    R   R   "   s
    
R    c         C   s   t  i | | d t ƒ \ } } } | d j o t  i |  _
 n8 | d j o t  i |  _
 n | d j o t d ‚ n | | f S(   Ni    iÿÿÿÿi   i   s%   UTF-16 stream does not start with BOM(   R   t   utf_16_ex_decodeR   R   R	   t   objectt   consumedR   t   utf_16_le_decodeR
   R   t   utf_16_be_decodet   UnicodeError(   R
   R   R   R   R   R   (    (    R   R   )   s    !(   R   R   R   R   (    (    (    R   R       s   	c           C   s   t  t t t f S(   N(   R   R   R   R   (    (    (    R   t   getregentry6   s    (	   t   __doc__R   R   R   R   R   R   R   R!   (   R   R   R   R   R!   R   R   (    (    R   t   ?   s   	