Skip to content

Commit

Permalink
Improve stream overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcarbon authored and BobLd committed Apr 12, 2024
1 parent 90e07bc commit 0f7077b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/UglyToad.PdfPig/IO/StreamWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public override void SetLength(long value)
Stream.SetLength(value);
}

#if NET6_0_OR_GREATER
public override int Read(Span<byte> buffer)
{
return Stream.Read(buffer);
}
#endif

public override int Read(byte[] buffer, int offset, int count)
{
return Stream.Read(buffer, offset, count);
Expand Down
2 changes: 1 addition & 1 deletion src/UglyToad.PdfPig/Images/Png/PngStreamWriteHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override void Write(byte[] buffer, int offset, int count)
inner.Write(buffer, offset, count);
}

#if NET8_0_OR_GREATER
#if NET6_0_OR_GREATER
public override void Write(ReadOnlySpan<byte> buffer)
{
crc.Append(buffer);
Expand Down

0 comments on commit 0f7077b

Please sign in to comment.