public static byte[] Slice(this ICircularBuffer <byte> array, int index, int length) { if (array == null) { throw new ArgumentNullException("array"); } if (index + length > array.Size) { throw new ArgumentOutOfRangeException("length", string.Format("index: ({0}), length({1}) index + length cannot be longer than Array.length({2})", index, length, array.Size)); } var result = new byte[length]; array.DirectBufferRead(index, result, 0, length); return(result); }
public override IByteBuf GetBytes(int index, byte[] destination, int dstIndex, int length) { CheckDstIndex(index, length, dstIndex, destination.Length); InternalBuffer.DirectBufferRead(index, destination, dstIndex, index); return(this); }