From b6807656927da5925fd0579dd89dc460195363bf Mon Sep 17 00:00:00 2001 From: Gert Driesen Date: Sun, 16 Jul 2017 20:06:12 +0200 Subject: [PATCH] Add comment to clarify that StreamReader uses a buffer size of 1024 bytes. --- src/Renci.SshNet/SftpClient.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Renci.SshNet/SftpClient.cs b/src/Renci.SshNet/SftpClient.cs index 59d222bb..3bde01ad 100644 --- a/src/Renci.SshNet/SftpClient.cs +++ b/src/Renci.SshNet/SftpClient.cs @@ -1,5 +1,4 @@ using System; - using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; @@ -1425,6 +1424,9 @@ namespace Renci.SshNet /// The method was called after the client was disposed. public string[] ReadAllLines(string path, Encoding encoding) { + // we use the default buffer size for StreamReader - which is 1024 bytes - and the configured buffer size + // for the SftpFileStream; may want to revisit this later + var lines = new List(); using (var stream = new StreamReader(OpenRead(path), encoding)) { @@ -1464,6 +1466,9 @@ namespace Renci.SshNet /// The method was called after the client was disposed. public string ReadAllText(string path, Encoding encoding) { + // we use the default buffer size for StreamReader - which is 1024 bytes - and the configured buffer size + // for the SftpFileStream; may want to revisit this later + using (var stream = new StreamReader(OpenRead(path), encoding)) { return stream.ReadToEnd();