Add support of ReadOnlySequence and IBufferWriter
See original GitHub issueDescription
MagickImage recently began support initialization from ReadOnlySpan<byte>
, which is great! But some times source memory can be fragmented and to prevent heap allocation it would be nice to have initialization from ReadOnlySequence<byte>
. Also writing output is still restricted to Stream
and coresponding to Span’s it would be good to have overload for IBufferWriter<byte>
.
Proposal
Add constructor overload MagickImage(ReadOnlySequence<byte> data)
and coresponding Read
overload.
Add Write overload MagickImage.Write(IBufferWriter<byte> buffer)
.
System Configuration
- Magick.NET version: Magick.NET-Q16-x64 8.1.0
- Environment (Operating system, version and so on): Windows 10 x64
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
System.Buffers - .NET
They're primarily used to support PipeReader objects. IBufferWriter<T>. System.Buffers.IBufferWriter<T> is a contract for synchronous buffered ...
Read more >How to make the fastest .NET Serializer with .NET 7 / C# 11 ...
I have been working on AOT support with code generators using Roslyn ... note: serialize parameter should be `ref readonly` but current lang ......
Read more >Class BufferHelpers | .NEXT
Concat(IBufferWriter<char>, scoped ReadOnlySpan<string?>) ... Converts two memory blocks to ReadOnlySequence<T> data type. ... The value to add.
Read more >My mental model of Span, Memory and ReadOnlySequence ...
After working a bit with Span , Memory , ReadOnlySequence and IBufferWriter I model it in my head in a bit different way....
Read more >PooledGrowableBufferHelper 1.0.14
Implements IBufferWriter<byte> interface, which can be used to append data to the end of the stream. Provides a ReadOnlySequence<byte> view ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I added a unit test for this to make sure this works but it I only tested this with
1
byte sequences. This probably fails with sequences of a specific size will add a test for this and get this fixed.edit: I am working on a fix and I will publish a new release in a couple hours.
Just realized it might also be possible to use the
ReadOnlySequence<byte>
, will need to run some experiments.