Download a file from the FTP server and write it to the given stream.
Namespace: EnterpriseDT.Net.FtpAssembly: edtFTPnet (in edtFTPnet.dll) Version: 2.2.3.0
Syntax
C# |
---|
public virtual void DownloadStream( Stream destStream, string remoteFile ) |
Visual Basic |
---|
Public Overridable Sub DownloadStream ( _ destStream As Stream, _ remoteFile As String _ ) |
Visual C++ |
---|
public: virtual void DownloadStream( Stream^ destStream, String^ remoteFile ) |
Parameters
- destStream
- Type: System.IO..::..Stream
Data stream to write data to.
- remoteFile
- Type: System..::..String
Name of remote file in current working directory.
Remarks
Transfers are in the current TransferType. The stream is closed after the transfer is complete if CloseStreamsAfterTransfer is true (the default) is are left open otherwise. If the stream is left open the its position will be at the end of the stream. Use Seek(Int64, SeekOrigin) to change the position if required.
Examples
The following example shows a file being downloaded into a
MemoryStream, which is then used to initialize a
StreamReader.
Copy | |
---|---|
ftpConnection.CloseStreamsAfterTransfer = false; MemoryStream memStr = new MemoryStream(); ftpConnection.DownloadStream(memStr, "filename"); memStr.Seek(0, SeekOrigin.Begin); StreamReader inStr = new StreamReader(memStr); ... use sr for whatever ... |