Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override more Stream members on System.IO.Compression streams #54518

Merged
merged 1 commit into from
Jun 25, 2021

Conversation

stephentoub
Copy link
Member

No description provided.

@ghost
Copy link

ghost commented Jun 21, 2021

Tagging subscribers to this area: @dotnet/area-system-io-compression
See info in area-owners.md if you want to be subscribed.

Issue Details
Author: stephentoub
Assignees: -
Labels:

area-System.IO.Compression

Milestone: 6.0.0

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @stephentoub !

public override int ReadByte()
{
byte b = default;
return Read(MemoryMarshal.CreateSpan(ref b, 1)) == 1 ? b : -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I was not aware of the existence of MemoryMarshal.CreateSpan. We should most probably use it in FileStream as well:

Span<byte> buffer = stackalloc byte[1];
int bytesRead = Read(buffer);
return bytesRead == 1 ? buffer[0] : -1;

@adamsitnik adamsitnik merged commit e9f101c into dotnet:main Jun 25, 2021
@stephentoub stephentoub deleted the compressionstreamoverrides branch June 27, 2021 16:03
@ghost ghost locked as resolved and limited conversation to collaborators Jul 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants