Esempio n. 1
0
 public override IByteBuf SetBytes(int index, IByteBuf src, int srcIndex, int length)
 {
     CheckSrcIndex(index, length, srcIndex, src.ReadableBytes);
     if (src.HasArray)
     {
         Buffer.SetRange(index, src.InternalArray().Slice(srcIndex, length));
     }
     else
     {
         src.ReadBytes(Buffer, srcIndex, length);
     }
     return(this);
 }
Esempio n. 2
0
 public override IByteBuf GetBytes(int index, IByteBuf destination, int dstIndex, int length)
 {
     CheckDstIndex(index, length, dstIndex, destination.Capacity);
     if (destination.HasArray)
     {
         GetBytes(index, destination.InternalArray(), dstIndex, length);
     }
     else
     {
         destination.SetBytes(dstIndex, this, index, length);
     }
     return(this);
 }
Esempio n. 3
0
 public override IByteBuf SetBytes(int index, IByteBuf src, int srcIndex, int length)
 {
     CheckSrcIndex(index, length, srcIndex, src.ReadableBytes);
     if (src.HasArray)
     {
         InternalBuffer.SetRange(index, src.InternalArray().Slice(srcIndex, length));
     }
     else
     {
         var tempBuffer = new byte[length];
         src.ReadBytes(tempBuffer, srcIndex, length);
         InternalBuffer.SetRange(index, tempBuffer);
     }
     return(this);
 }
Esempio n. 4
0
 public override IByteBuf WriteBytes(IByteBuf src, int srcIndex, int length)
 {
     EnsureWritable(length);
     if (src.HasArray)
     {
         InternalBuffer.DirectBufferWrite(src.InternalArray().Slice(srcIndex, length));
         src.SetReaderIndex(src.ReaderIndex + length);
     }
     else
     {
         var tempBuffer = new byte[length];
         src.ReadBytes(tempBuffer, srcIndex, length);
         InternalBuffer.DirectBufferWrite(tempBuffer);
     }
     return(this);
 }
Esempio n. 5
0
 public override byte[] InternalArray()
 {
     return(_buffer.InternalArray());
 }
Esempio n. 6
0
 public override IByteBuf WriteBytes(IByteBuf src, int srcIndex, int length)
 {
     EnsureWritable(length);
     if (src.HasArray)
     {
         InternalBuffer.DirectBufferWrite(src.InternalArray().Slice(srcIndex, length));
         src.SetReaderIndex(src.ReaderIndex + length);
     }
     else
     {
         var tempBuffer = new byte[length];
         src.ReadBytes(tempBuffer, srcIndex, length);
         InternalBuffer.DirectBufferWrite(tempBuffer);
     }
     return this;
 }
Esempio n. 7
0
 public override IByteBuf SetBytes(int index, IByteBuf src, int srcIndex, int length)
 {
     CheckSrcIndex(index, length, srcIndex, src.ReadableBytes);
     if (src.HasArray)
     {
         InternalBuffer.SetRange(index, src.InternalArray().Slice(srcIndex, length));
     }
     else
     {
         var tempBuffer = new byte[length];
         src.ReadBytes(tempBuffer, srcIndex, length);
         InternalBuffer.SetRange(index, tempBuffer);
     }
     return this;
 }
Esempio n. 8
0
 public override IByteBuf SetBytes(int index, IByteBuf src, int srcIndex, int length)
 {
     CheckSrcIndex(index, length, srcIndex, src.ReadableBytes);
     if (src.HasArray)
     {
         Buffer.SetRange(index, src.InternalArray().Slice(srcIndex, length));
     }
     else
     {
         src.ReadBytes(Buffer, srcIndex, length);
     }
     return this;
 }
 public override IByteBuf GetBytes(int index, IByteBuf destination, int dstIndex, int length)
 {
     CheckDstIndex(index, length, dstIndex, destination.Capacity);
     if (destination.HasArray)
     {
         GetBytes(index, destination.InternalArray(), dstIndex, length);
     }
     else
     {
         destination.SetBytes(dstIndex, this, index, length);
     }
     return this;
 }