function ReadFile(const Handle: TScSFTPFileHandle; FileOffset: Int64; var Buffer; Count: integer): integer; overload;
function ReadFile(const Handle: TScSFTPFileHandle; FileOffset: Int64; var Buffer: TBytes; Offset, Count: integer): integer; overload;
Description
Call the ReadFile method to read remote file data.
If the NonBlocking property is set to False ReadFile returns the amount of data read. Otherwise it returns 0 and the data can be read from the buffer on processing the OnData event. OnData may occur several times for a single call of ReadFile, if the amount of requested data exceeds the possible amount of data the server can return during one request (refer to the ReadBlockSize property). If the servers returns an error, the OnError event is generated.
ReadFile sets the EOF property to True if the end of file was reached.
Parameters:
• | Handle - a handle previously returned in the response to OpenFile. |
• | FileOffset - the offset in bytes relative to the beginning of the file that the read starts at. This parameter is ignored if TEXT MODE was specified during the open. |
• | Buffer - the buffer to which the data will be read. If the buffer is specified, it will be returned by the OnData event handler. If NonBlocking is True, the parameter can have the nil value. |
• | Offset - the position in the buffer from which to start writing the data. |
• | Count - the maximum number of bytes to read. |
See Also