Package wtf :: Package impl :: Module _util :: Class ContentLengthReader
[hide private]
[frames] | no frames]

Class ContentLengthReader

source code

object --+
         |
        ContentLengthReader

Emulate EOF condition after Content length is reached
Instance Methods [hide private]
 
__init__(self, stream, clen)
Initialization
source code
str
read(self, size)
Read (at max) size bytes
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
int _left
Octets that still can be read
file _stream
Stream to read from
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, stream, clen)
(Constructor)

source code 
Initialization
Parameters:
  • stream (file) - The stream to read from
  • clen (int) - The length of the stream
Overrides: object.__init__

read(self, size)

source code 
Read (at max) size bytes
Parameters:
  • size (int) - Maximum number of octets to read
Returns: str
The bytes read (empty on EOF)