Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/SharpCompress/IO/BufferedSubStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@ public override int Read(byte[] buffer, int offset, int count)
return count;
}

public override int ReadByte()
{
if (BytesLeftToRead == 0)
{
return -1;
}

if (_cacheLength == 0)
{
_cacheOffset = 0;
Stream.Position = origin;
_cacheLength = Stream.Read(_cache, 0, _cache.Length);
origin += _cacheLength;
}

int value = _cache[_cacheOffset];

_cacheOffset++;
_cacheLength--;
BytesLeftToRead--;

return value;
}

public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException();

public override void SetLength(long value) => throw new NotSupportedException();
Expand Down