Ejemplo n.º 1
0
 public override ByteBuf SetBytes(int index, ByteBuf src, int srcIndex, int length)
 {
     CheckSrcIndex(index, length, srcIndex, src.Capacity);
     // avoid check for memory address
     if (src.HasArray())
     {
         SetBytes(index, src.Array(), src.ArrayOffset() + srcIndex, length);
     }
     else
     {
         src.GetBytes(srcIndex, _array, index, length);
     }
     return(this);
 }
Ejemplo n.º 2
0
        public override ByteBuf GetBytes(int index, sbyte[] dst, int dstIndex, int length)
        {
            CheckDstIndex(index, length, dstIndex, dst.Length);
            if (length == 0)
            {
                return(this);
            }

            int i = ToComponentIndex(index);

            while (length > 0)
            {
                Component c           = _components[i];
                ByteBuf   s           = c._buf;
                int       adjustment  = c._offset;
                int       localLength = Math.Min(length, s.Capacity - (index - adjustment));
                s.GetBytes(index - adjustment, dst, dstIndex, localLength);
                index    += localLength;
                dstIndex += localLength;
                length   -= localLength;
                i++;
            }
            return(this);
        }
Ejemplo n.º 3
0
 public override ByteBuf GetBytes(int index, sbyte[] dst, int dstIndex, int length)
 {
     _buffer.GetBytes(index, dst, dstIndex, length);
     return(this);
 }
Ejemplo n.º 4
0
 public override ByteBuf GetBytes(int index, sbyte[] dst, int dstIndex, int length)
 {
     CheckIndex(index, length);
     _buffer.GetBytes(index + _adjustment, dst, dstIndex, length);
     return(this);
 }