Package paramiko :: Module channel :: Class ChannelFile
[show private | hide private]
[frames | no frames]

Type ChannelFile

  object --+    
           |    
BufferedFile --+
               |
              ChannelFile

Known Subclasses:
ChannelStderrFile

A file-like wrapper around Channel. A ChannelFile is created by calling Channel.makefile.

Bug: To correctly emulate the file object created from a socket's makefile method, a Channel and its ChannelFile should be able to be closed or garbage-collected independently. Currently, closing the ChannelFile does nothing but flush the buffer.

Method Summary
  __init__(self, channel, mode, bufsize)
str __repr__(self)
Returns a string representation of this object, for debugging.
  seek(self, offset, whence)
Set the file's current position, like stdio's fseek.
    Inherited from BufferedFile
  __del__(self)
iterator __iter__(self)
Returns an iterator that can be used to iterate over the lines in this file.
  close(self)
Close the file.
  flush(self)
Write out any data in the write buffer.
str next(self)
Returns the next line from the input, or raises StopIteration when EOF is hit.
str read(self, size)
Read at most size bytes from the file (less if we hit the end of the file first).
str readline(self, size)
Read one entire line from the file.
list readlines(self, sizehint)
Read all remaining lines using readline and return them as a list.
int tell(self)
Return the file's current position.
  write(self, data)
Write data to the file.
  writelines(self, sequence)
Write a sequence of strings to the file.
iterator xreadlines(self)
Identical to iter(f).
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
    Inherited from BufferedFile
int SEEK_CUR = 1                                                                     
int SEEK_END = 2                                                                     
int SEEK_SET = 0                                                                     

Method Details

__repr__(self)
(Representation operator)

Returns a string representation of this object, for debugging.
Returns:
str
Overrides:
__builtin__.object.__repr__

seek(self, offset, whence=0)

Set the file's current position, like stdio's fseek. Not all file objects support seeking.
Parameters:
offset - position to move to within the file, relative to whence.
           (type=int)
whence - type of movement: 0 = absolute; 1 = relative to the current position; 2 = relative to the end of the file.
           (type=int)
Raises:
IOError - if the file doesn't support random access.

Note: If a file is opened in append mode ('a' or 'a+'), any seek operations will be undone at the next write (as the file position will move back to the end of the file).


Generated by Epydoc 2.1 on Sun Jul 17 23:44:28 2005 http://epydoc.sf.net