We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2b3788 commit 9473c1aCopy full SHA for 9473c1a
LiteDB/Client/Storage/LiteFileStream.Read.cs
@@ -10,6 +10,9 @@ public partial class LiteFileStream<TFileId> : Stream
10
public override int Read(byte[] buffer, int offset, int count)
11
{
12
if (_mode != FileAccess.Read) throw new NotSupportedException();
13
+ if (_streamPosition == Length) {
14
+ return 0;
15
+ }
16
17
var bytesLeft = count;
18
@@ -51,10 +54,14 @@ private byte[] GetChunkData(int index)
51
54
52
55
private void SetReadStreamPosition(long newPosition)
53
56
- if (newPosition < 0 || newPosition > Length)
57
+ if (newPosition < 0)
58
59
throw new ArgumentOutOfRangeException();
60
}
61
+ if (newPosition >= Length) {
62
+ _streamPosition = Length;
63
+ return;
64
65
_streamPosition = newPosition;
66
67
// calculate new chunk position
0 commit comments