summaryrefslogtreecommitdiff
path: root/FireBase/Streaming/NonBlockingStreamReader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'FireBase/Streaming/NonBlockingStreamReader.cs')
-rw-r--r--FireBase/Streaming/NonBlockingStreamReader.cs22
1 files changed, 11 insertions, 11 deletions
diff --git a/FireBase/Streaming/NonBlockingStreamReader.cs b/FireBase/Streaming/NonBlockingStreamReader.cs
index 2ac83fd..ab01510 100644
--- a/FireBase/Streaming/NonBlockingStreamReader.cs
+++ b/FireBase/Streaming/NonBlockingStreamReader.cs
@@ -17,29 +17,29 @@
private readonly int bufferSize;
private string cachedData;
-
- public NonBlockingStreamReader(Stream stream, int bufferSize = DefaultBufferSize)
+
+ public NonBlockingStreamReader(Stream stream, int bufferSize = DefaultBufferSize)
{
this.stream = stream;
this.bufferSize = bufferSize;
- this.buffer = new byte[bufferSize];
+ buffer = new byte[bufferSize];
- this.cachedData = string.Empty;
+ cachedData = string.Empty;
}
public override string ReadLine()
{
- var currentString = this.TryGetNewLine();
-
+ var currentString = TryGetNewLine();
+
while (currentString == null)
{
- var read = this.stream.Read(this.buffer, 0, this.bufferSize);
+ var read = stream.Read(buffer, 0, bufferSize);
var str = Encoding.UTF8.GetString(buffer, 0, read);
cachedData += str;
- currentString = this.TryGetNewLine();
+ currentString = TryGetNewLine();
}
-
+
return currentString;
}
@@ -50,11 +50,11 @@
if (newLine >= 0)
{
var r = cachedData.Substring(0, newLine + 1);
- this.cachedData = cachedData.Remove(0, r.Length);
+ cachedData = cachedData.Remove(0, r.Length);
return r.Trim();
}
return null;
}
}
-}
+} \ No newline at end of file