Different buffers of bytes. Array, unmanaged heap and memory mapped file implementations.
All of them implement IByteBlock interface:
public interface IByteBlock : IDisposable {
int Length { get; }
Span<byte> AsSpan();
UnmanagedMemoryStream AsStream();
}Each block provide read/write span or stream.
Each call of
AsSpan()orAsStream()produces new one.
NOTE: Due to
Span<T>Lengthproperty beingint, maximum size of anyIByteBlockisint.MaxValue:2 147 483 647 (0x7fffffff).
Backed by array of bytes.
Maximum length of
byte[]in C# is2 147 483 591 (0x7FFFFFC7)
Buffer allocated in heap.
Buffer persisted on file system.
Can be used for fast writing or reading of files smaller than int.MaxValue (2GiB - 1 byte).