Class Net::SFTP::Operations::Read
In: lib/net/sftp/operations/read.rb
Parent: Abstract

Implements the read operation, which reads data from an open file handle. This also implements the common case of reading to the end of the file. In that case, the callback is guaranteed to receive the contents of the entire file in one chunk.

Methods

do_data   do_status   perform  

Constants

DEFAULT_CHUNK_SIZE = 64 * 1024   The default maximum amount of data to read at once when reading an entire file.

Public Instance methods

Invoked when a data packet is received from the server. If the original request was for an entire file, this will send another read request, offset to the end of the data that has been read so far. Otherwise, the callback will be invoked directly.

Invoked when a status code is received from the server. If the code is FX_EOF, then no data could be read because the end of the file was reached. In this case, the callback is invoked with the data that has been read so far. Other status codes are handled by the superclass.

Perform the operation. If length is less than 0 (the default), then the entire file (from the given offset) will be read and returned in "one fell swoop". Otherwise, the given length of data will be requested.

[Validate]