public override Task <int> SetBytesAsync(int index, Stream src, int length, CancellationToken cancellationToken)
        {
            this.CheckIndex(index, length);
            int read = UnsafeByteBufferUtil.SetBytes(this, this.Addr(index), index, src, length);

            return(Task.FromResult(read));
        }
Пример #2
0
        public override IByteBuffer SetBytes(int index, IByteBuffer src, int srcIndex, int length)
        {
            this.CheckIndex(index, length);

            fixed(byte *addr = &this.Addr(index))
            UnsafeByteBufferUtil.SetBytes(this, addr, index, src, srcIndex, length);

            return(this);
        }
Пример #3
0
 public sealed override IByteBuffer SetBytes(int index, byte[] src, int srcIndex, int length)
 {
     if (src is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.src);
     }
     CheckSrcIndex(index, length, srcIndex, src.Length);
     UnsafeByteBufferUtil.SetBytes(Addr(index), src, srcIndex, length);
     return(this);
 }
        public sealed override IByteBuffer SetBytes(int index, byte[] src, int srcIndex, int length)
        {
            if (src is null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.src); }
            CheckSrcIndex(index, length, srcIndex, src.Length);
            if (0u >= (uint)length) { return this; }

            fixed (byte* addr = &Addr(index))
            {
                UnsafeByteBufferUtil.SetBytes(addr, src, srcIndex, length);
                return this;
            }
        }
Пример #5
0
 public override IByteBuffer SetBytes(int index, byte[] src, int srcIndex, int length)
 {
     this.CheckIndex(index, length);
     UnsafeByteBufferUtil.SetBytes(this, this.Addr(index), index, src, srcIndex, length);
     return(this);
 }