Package pyraf :: Module subproc :: Class ReadBuf
[hide private]
[frames] | no frames]

Class ReadBuf

source code

Output buffer for non-blocking reads on selectable files like pipes and sockets. Init with a file descriptor for the file.

Instance Methods [hide private]
 
__init__(self, fd, maxChunkSize=1024)
Encapsulate file descriptor FD, with optional MAX_READ_CHUNK_SIZE (default 1024).
source code
 
fileno(self) source code
 
peekPendingChar(self, timeout=0)
Return, but don't consume, first character of unconsumed output from file, or empty string if none.
source code
 
readPendingChar(self)
Consume first character of unconsumed output from file, or empty string if none.
source code
 
readPendingChars(self, max=None)
Consume uncomsumed output from FILE, or empty string if nothing pending.
source code
 
readPendingLine(self, block=0)
Return pending output from FILE, up to first newline (inclusive).
source code
 
readline(self)
Return next output line from file, blocking until it is received.
source code
 
read(self, nchars)
Read nchars from input, blocking until they are available.
source code
Method Details [hide private]

peekPendingChar(self, timeout=0)

source code 

Return, but don't consume, first character of unconsumed output from file, or empty string if none. If timeout is set, waits maximum of timeout seconds before returning. Default is timeout=0 (do not wait at all.)

readPendingLine(self, block=0)

source code 

Return pending output from FILE, up to first newline (inclusive).

Does not block unless optional arg BLOCK is true. This may return a partial line if the input line is longer than chunkSize (default 1024) characters.

read(self, nchars)

source code 

Read nchars from input, blocking until they are available. Returns a shorter string on EOF.