Package paramiko :: Module sftp_file :: Class SFTPFile
[show private | hide private]
[frames | no frames]

Class SFTPFile

  object --+    
           |    
BufferedFile --+
               |
              SFTPFile


Proxy object for a file on the remote server, in client mode SFTP.
Method Summary
  __init__(self, sftp, handle, mode, bufsize)
  close(self)
Close the file.
float gettimeout(self)
Returns the timeout in seconds (as a float) associated with the socket or ssh Channel used for this file.
  seek(self, offset, whence)
Set the file's current position, like stdio's fseek.
  setblocking(self, blocking)
Set blocking or non-blocking mode on the underiying socket or ssh Channel.
  settimeout(self, timeout)
Set a timeout on read/write operations on the underlying socket or ssh Channel.
SFTPAttributes stat(self)
Retrieve information about this file from the remote system.
  _get_size(self)
(subclass override) Return the size of the file.
  _read(self, size)
(subclass override) Read data from the stream.
  _write(self, data)
(subclass override) Write data into the stream.
    Inherited from BufferedFile
iterator __iter__(self)
Returns an iterator that can be used to iterate over the lines in this 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).
  _record_newline(self, newline)
  _set_mode(self, mode, bufsize)
Subclasses call this method to initialize the BufferedFile.
  _write_all(self, data)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T

Class Variable Summary
int MAX_REQUEST_SIZE = 32768                                                                 
    Inherited from BufferedFile
int SEEK_CUR = 1                                                                     
int SEEK_END = 2                                                                     
int SEEK_SET = 0                                                                     
int _DEFAULT_BUFSIZE = 8192                                                                  

Method Details

close(self)

Close the file. Future read and write operations will fail.
Overrides:
paramiko.file.BufferedFile.close (inherited documentation)

gettimeout(self)

Returns the timeout in seconds (as a float) associated with the socket or ssh Channel used for this file.
Returns:
float

See Also: Channel.gettimeout

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.
Overrides:
paramiko.file.BufferedFile.seek (inherited documentation)

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).

setblocking(self, blocking)

Set blocking or non-blocking mode on the underiying socket or ssh Channel.
Parameters:
blocking - 0 to set non-blocking mode; non-0 to set blocking mode.
           (type=int)

See Also: Channel.setblocking

settimeout(self, timeout)

Set a timeout on read/write operations on the underlying socket or ssh Channel.
Parameters:
timeout - seconds to wait for a pending read/write operation before raising socket.timeout, or None for no timeout
           (type=float)

See Also: Channel.settimeout

stat(self)

Retrieve information about this file from the remote system. This is exactly like SFTP.stat, except that it operates on an already-open file.
Returns:
an object containing attributes about this file.
           (type=SFTPAttributes)

_get_size(self)

(subclass override) Return the size of the file. This is called from within _set_mode if the file is opened in append mode, so the file position can be tracked and seek and tell will work correctly. If the file is a stream that can't be randomly accessed, you don't need to override this method,
Overrides:
paramiko.file.BufferedFile._get_size (inherited documentation)

_read(self, size)

(subclass override) Read data from the stream. Return None or raise EOFError to indicate EOF.
Overrides:
paramiko.file.BufferedFile._read (inherited documentation)

_write(self, data)

(subclass override) Write data into the stream.
Overrides:
paramiko.file.BufferedFile._write (inherited documentation)

Class Variable Details

MAX_REQUEST_SIZE

Type:
int
Value:
32768                                                                 

Generated by Epydoc 2.0 on Thu Jun 30 20:46:57 2005 http://epydoc.sf.net