This defines the Stream class, encapsulating a file descriptor and related functions.
This class encapsulates a data tunnel, represented by a UNIX file descriptor.
none
Constructor initializing a stream.
__init__ ( self, fd, name, ) |
Initializes a Stream instance setting its attributes according to arguments.
Table 4-120. Arguments for Stream.__init__()
self | this instance |
fd | the fd to encapsulate |
name | name to use in logs |
Method reading up to count bytes from the stream.
read ( self, count ) |
This method reads up to count bytes from the stream and returns it as a string.
Table 4-121. Arguments for Stream.read()
self | this instance |
count | maximum number of bytes to read |
Method writing a buffer to the stream.
write ( self, buf ) |
This method writes the contents of the given buffer to the stream.
Table 4-122. Arguments for Stream.write()
self | this instance |
buf | buffer to write |