Package bsddb :: Module dbrecio
[hide private]
[frames] | no frames]

Module dbrecio

File-like objects that read from or write to a bsddb record.

This implements (nearly) all stdio methods.

f = DBRecIO(db, key, txn=None)
f.close()           # explicitly release resources held
flag = f.isatty()   # always false
pos = f.tell()      # get current position         # set current position, mode)   # mode 0: absolute; 1: relative; 2: relative to EOF
buf =      # read until EOF
buf =     # read up to n bytes
f.truncate([size])  # truncate file at to at most size (default: current pos)
f.write(buf)        # write at current position
f.writelines(list)  # for line in list: f.write(line)

- fileno() is left unimplemented so that code which uses it triggers
  an exception early.
- There's a simple test set (see end of this file) - not yet updated
  for DBRecIO.
- readline() is not implemented yet.

    Itamar Shtull-Trauring <>

Classes [hide private]

Imports: errno, string