Discuss this help topic in SecureBlackbox Forum

TElSftpClient.Read

TElSftpClient     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Reads the part of a remote file.

Declaration

[C#/Java]
    int Read(byte[] Handle, long Offset, byte[] Buffer, int StartIndex, int Size);
    bool Read(byte[] Handle, long Offset, int Size);

[VB.NET]
    Function Read(ByVal Handle As Byte(), ByVal Offset As Long, ByVal Buffer As Byte(), ByVal StartIndex As Integer, ByVal Size As Integer) As Integer
    Function Read(ByVal Handle As Byte(), ByVal Offset As Long, ByVal Size As Integer) As Boolean

[Pascal]
    function Read(Handle : TSBSftpFileHandle; Offset : Int64; Size : integer): Boolean;
    function Read(Handle : TSBSftpFileHandle; Offset : Int64; Buffer : ByteArray; Size : integer): Boolean;
    function ReadSync(Handle: TSBSftpFileHandle; Offset: Int64; Size: integer): integer;
    function ReadSync(Handle: TSBSftpFileHandle; Offset: Int64; Buffer: ByteArray; Size: integer): integer;
    
    type TSBSftpFileHandle = ByteArray;

[C++]
    int32_t Read(const std::vector<uint8_t> &Handle, int64_t Offset, void * Buffer, int32_t Size);
    bool Read(const std::vector<uint8_t> &Handle, int64_t Offset, int32_t Size);

[PHP]
    integer Read(array of byte|string|NULL $Handle, integer $Offset, TSBPointer|array of byte|string|NULL $Buffer, integer $Size)
    bool Read(array of byte|string|NULL $Handle, integer $Offset, integer $Size)

Parameters

  • Handle - handle to opened file, returned by OnOpenFile event
  • Offset - position from which the file is read
  • Buffer - the buffer to receive the data
  • StartIndex - position in the buffer from which to start writing the data
  • Size - the number of bytes to read

Return value

     Read returns:
    True if operation was completed successfully;
    False otherwise.

     ReadSync returns the number of bytes which were actually read.

Description

    Use this method to read the block of data from the opened file. Read method is asynchronous and returns immediately (unless SynchronousMode is true). ReadSync method is synchronous and returns after the data arrives or error happens.

     If the data from file was successfully read, the OnData event is fired and the received data is passed to the event handler. The OnError event is fired if the error happened. Note, that if Buffer parameter is passed, it will be returned back in OnData.

    Do not pass the handle to opened directory as Handle.

See also:     Write     ReadDirectory    

Discuss this help topic in SecureBlackbox Forum