Module Stream

This defines the Stream class, encapsulating a file descriptor and related functions.

Class Stream

This class encapsulates a data tunnel, represented by a UNIX file descriptor.

Constructor __init__

Constructor initializing a stream.

Synopsis

__init__ (
        self,
        fd,
        name,
        )

Description

Initializes a Stream instance setting its attributes according to arguments.

Arguments

Table 4-120. Arguments for Stream.__init__()

selfthis instance
fdthe fd to encapsulate
namename to use in logs

Method read

Method reading up to count bytes from the stream.

Synopsis

read ( self,  count )

Description

This method reads up to count bytes from the stream and returns it as a string.

Arguments

Table 4-121. Arguments for Stream.read()

selfthis instance
countmaximum number of bytes to read

Method write

Method writing a buffer to the stream.

Synopsis

write ( self,  buf )

Description

This method writes the contents of the given buffer to the stream.

Arguments

Table 4-122. Arguments for Stream.write()

selfthis instance
bufbuffer to write