Implements the write operation. Handles, automatically, the looping necessary to write a large data set.

Methods
Constants
CHUNK_SIZE = 32 * 1024
  The maximum size of data that will be written at one time.
Public Instance methods
do_status( code, message, language )

Invoked when the server sends a status packet. If the status is FX_OK, then the callback is invoked (if all data has been written), or the next chunk is written to the server (if more data remains). Other status codes are handled by the superclass.

    # File lib/net/sftp/operations/write.rb, line 44
44:     def do_status( code, message, language )
45:       if code == FX_OK
46:         @log.debug "[#{@id}] chunk written" if @log.debug?
47:         @pos += CHUNK_SIZE
48: 
49:         if @pos > @data.length
50:           @callback[ OK ]
51:           return
52:         end
53: 
54:         @driver.write @id, @handle, @offset + @pos, @data[@pos,CHUNK_SIZE]
55:         @session.register @id, self
56:       else
57:         super
58:       end
59:     end
perform( handle, data, offset=0 )

Perform the operation. Only CHUNK_SIZE portions of the data parameter will be written at a time, with subsequent chunks being writteni automatically when prior chunks complete.

    # File lib/net/sftp/operations/write.rb, line 31
31:     def perform( handle, data, offset=0 )
32:       @handle = handle
33:       @offset = offset
34:       @data = data
35:       @pos = 0
36: 
37:       @driver.write( nil, handle, offset, data[0,CHUNK_SIZE] )
38:     end