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

Class ReseekFile

source code

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.

Instance Methods [hide private]
 
__init__(self, file) source code
 
seek(self, offset, whence=0)
offset, whence = 0
source code
 
tell(self)
the current position of the file
source code
 
_read(self, size) source code
 
read(self, size=-1)
read up to 'size' bytes from the file
source code
 
readline(self)
read a line from the file
source code
 
readlines(self)
read all remaining lines from the file
source code
 
_check_no_buffer(self) source code
 
nobuffer(self)
tell the ReseekFile to stop using the buffer once it's exhausted
source code
Method Details [hide private]

seek(self, offset, whence=0)

source code 

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)

source code 

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.

read(self, size=-1)

source code 

read up to 'size' bytes from the file

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