Package Bio :: Package EUtils :: Module ReseekFile :: Class ReseekFile
[show private | hide private]
[frames | no frames]

Class ReseekFile


wrap a file handle to allow seeks back to the beginning

Takes a file handle in the constructor.

See the module docstring for more documentation.
Method Summary
  __init__(self, file)
  nobuffer(self)
tell the ReseekFile to stop using the buffer once it's exhausted
  read(self, size)
read up to 'size' bytes from the file
  readline(self)
read a line from the file
  readlines(self)
read all remaining lines from the file
  seek(self, offset, whence)
offset, whence = 0
  tell(self)
the current position of the file
  _check_no_buffer(self)
  _read(self, size)

Method Details

nobuffer(self)

tell the ReseekFile to stop using the buffer once it's exhausted

read(self, size=-1)

read up to 'size' bytes from the file

Default is -1, which means to read to end of file.

readline(self)

read a line from the file

readlines(self)

read all remaining lines from the file

seek(self, offset, whence=0)

offset, whence = 0

Seek to a given byte position. Only supports whence == 0 and offset == the initial value of ReseekFile.tell() (which is usually 0, but not always.)

tell(self)

the current position of the file

The initial position may not be 0 if the underlying input file supports tell and it not at position 0.

Generated by Epydoc 2.1 on Wed Jan 31 09:59:40 2007 http://epydoc.sf.net