SliceBufferWriterExtensions

Namespace: SnowBank.Buffers · class

Helper methods for working with slice allocators and writers

Methods

Intern

static Slice Intern(ISliceAllocator writer, ReadOnlySpan<byte> data)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy

Returns: New slice, with identical content.

static Slice Intern(ISliceAllocator writer, ReadOnlyMemory<byte> data)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy

Returns: New slice, with identical content.

static Slice Intern(ISliceAllocator writer, Slice data)

Returns a copy of a Slice, using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy

Returns: New slice, with identical content.

static Slice Intern(ISliceAllocator writer, ReadOnlySpan<byte> data, Slice suffix)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra bytes that will be copied after data

Returns: New slice, with identical content plus the extra suffix.

static Slice Intern(ISliceAllocator writer, ReadOnlySpan<byte> data, byte suffix)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra byte that will be copied after data

Returns: New slice, with identical content plus the extra suffix.

static Slice Intern(ISliceAllocator writer, ReadOnlyMemory<byte> data, Slice suffix)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra bytes that will be copied after data

Returns: New slice, with identical content plus the extra suffix.

static Slice Intern(ISliceAllocator writer, ReadOnlyMemory<byte> data, byte suffix)

Returns a copy of a span of bytes using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra byte that will be copied after data

Returns: New slice, with identical content plus the extra suffix.

static Slice Intern(ISliceAllocator writer, Slice data, Slice suffix)

Returns a copy of a Slice, using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra bytes that will be copied after data

Returns: New slice, with identical content plus the extra suffix.

static Slice Intern(ISliceAllocator writer, Slice data, byte suffix)

Returns a copy of a Slice, using this allocator to allocate memory.

  • writer — Allocator that will store the bytes
  • data — Bytes to copy
  • suffix — Extra byte that will be copied after data

Returns: New slice, with identical content plus the extra suffix.