Package wtf :: Module stream
[hide private]
[frames] | no frames]

Module stream

source code

In order to use the stream, you need to supply an actual implementation of the low level octet stream. This stream implementation is useful in order to decorate other streams and not implement the full API every time.


Author: André Malo

Classes [hide private]
  GenericStream
Represents a buffered stream
  MinimalSocketStream
Minimal stream out of a socket
Functions [hide private]
str
_read_exact(read, size)
Read exactly size bytes with read, except on EOF
source code
str
read_exact(stream, size)
Read exactly size bytes from stream, except on EOF
source code
Variables [hide private]
GenericStream dev_null = GenericStream(dev_null())
/dev/null like stream (EOF on reading, doing nothing on writing)
  __package__ = 'wtf'
Function Details [hide private]

_read_exact(read, size)

source code 
Read exactly size bytes with read, except on EOF
Parameters:
  • read (callable) - The reading function
  • size (int) - expected number of bytes
Returns: str
The read bytes

read_exact(stream, size)

source code 
Read exactly size bytes from stream, except on EOF
Parameters:
  • stream (file) - The stream to read from.
  • size (int) - expected number of bytes
Returns: str
The read bytes