public BufferSegment(OwnedMemory<byte> buffer)
        {
            _buffer = buffer;
            Start = 0;
            End = 0;

            _buffer.AddReference();
        }
Exemple #2
0
        public BufferSegment(OwnedMemory <byte> buffer)
        {
            _buffer = buffer;
            Start   = 0;
            End     = 0;

            _buffer.AddReference();
        }
Exemple #3
0
        public BufferSegment(OwnedMemory <byte> buffer, int start, int end)
        {
            _buffer  = buffer;
            Start    = start;
            End      = end;
            ReadOnly = true;

            // For unowned buffers, we need to make a copy here so that the caller can
            // give up the give this buffer back to the caller
            var unowned = buffer as UnownedBuffer;

            if (unowned != null)
            {
                _buffer = unowned.MakeCopy(start, end - start, out Start, out End);
            }

            _buffer.AddReference();
        }