Implements the client side of the sftp protocol. File reads and writes
can be either synchronous (blocking) or asynchronous
(non-blocking). Asynchronous operation is much faster but is more
complicated to use when the interface is used for reading
parts of files. In asynchronous mode read and
write return immediately before the operation has
finished. The asyncWait method waits until all
operations have been completed and must be called before read
buffers are accessed.

read

Read data from an open file on the server and stores it in a
local file. The data is stored at the same position in the
local file as it is read from in the remote file.

Note that if the client is operating in
asynchronous mode then the method will return before data has been
written to the stream. In this case the asyncWait
method must be called, or the sftp file closed, before the stream
can be closed.

Parameters:

handle - Handle identifying file.

fileOffset - Where in the file to start to read.

fileTarget - Local file to write the data into.

len - Number of bytes to read. Must be less than
maxDataSize, which by default is 32768 bytes.

read

Read data from an open file on the server and stores it in a
local buffer. Note that if the client is operating in
asynchronous mode then the method will return before data has been
placed in the buffer. In this case the asyncWait
method must be called, or the file closed, before the data can
be safely accessed.

Parameters:

handle - Handle identifying file.

fileOffset - Where in the file to start to read.

buf - Local buffer to store data in. Must hold
len bytes at the given offset.

off - Offset in buffer to store data at.

len - Number of bytes to read. Must be less than
maxDataSize, which by default is 32768 bytes.

readFully

Read the entire file on the server and store in a local
stream. This method will be much faster if asynchronous mode is
used. It will always wait until the operation has completed
before returning, even if running in asynchronous mode.

Parameters:

handle - Handle identifying file. The handle will be
closed when the transfer has completed.

writeFully

Write an entire stream to a file on the server.
This method will be much faster if asynchronous mode is
used. It will always wait until the operation has completed
before returning, even if running in asynchronous mode.

Parameters:

handle - Handle identifying file. The handle will be
closed when the transfer has completed.

writeFully

Write an entire stream to a file on the server.
This method will be much faster if asynchronous mode is
used. It will always wait until the operation has completed
before returning, even if running in asynchronous mode.

Parameters:

handle - Handle identifying file. The handle will be
closed when the transfer has completed.

in - Stream to read data to write from.

append - if true then the data is written at the end of
the opened file. In this case the handle must have been opened
in append mode.

writeFully

Write data buffer to a file on the server.
This method will be much faster if asynchronous mode is
used. It will always wait until the operation has completed
before returning, even if running in asynchronous mode.

Parameters:

handle - Handle identifying file. The handle will be
closed when the transfer has completed.

in - Buffer containing data to write.

append - if true then the data is written at the end of
the opened file. In this case the handle must have been opened
in append mode.