示例#1
0
        /// <summary>
        /// Forms a slice out of the given <see cref="ReadableBuffer"/>, beginning at 'start', ending at 'end' (inclusive).
        /// </summary>
        /// <param name="start">The starting (inclusive) <see cref="ReadCursor"/> at which to begin this slice.</param>
        /// <param name="end">The ending (inclusive) <see cref="ReadCursor"/> of the slice</param>
        public ReadableBuffer Slice(ReadCursor start, ReadCursor end)
        {
            ReadCursorOperations.BoundsCheck(BufferEnd, end);
            ReadCursorOperations.BoundsCheck(end, start);

            return(new ReadableBuffer(start, end));
        }
示例#2
0
        /// <summary>
        /// Forms a slice out of the given <see cref="ReadableBuffer"/>, beginning at 'start', ending at 'end' (inclusive).
        /// </summary>
        /// <param name="start">The index at which to begin this slice.</param>
        /// <param name="end">The end (inclusive) of the slice</param>
        public ReadableBuffer Slice(long start, ReadCursor end)
        {
            ReadCursorOperations.BoundsCheck(BufferEnd, end);
            var begin = ReadCursorOperations.Seek(BufferStart, end, start);

            return(new ReadableBuffer(begin, end));
        }
示例#3
0
        /// <summary>
        /// Forms a slice out of the given <see cref="ReadableBuffer"/>, beginning at 'start', and is at most length bytes
        /// </summary>
        /// <param name="start">The starting (inclusive) <see cref="ReadCursor"/> at which to begin this slice.</param>
        /// <param name="length">The length of the slice</param>
        public ReadableBuffer Slice(ReadCursor start, long length)
        {
            ReadCursorOperations.BoundsCheck(BufferEnd, start);

            var end = ReadCursorOperations.Seek(start, BufferEnd, length, false);

            return(new ReadableBuffer(start, end));
        }