/// <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 index at which to begin this slice.</param> /// <param name="length">The length of the slice</param> public ReadableBuffer Slice(long start, long length) { var begin = ReadCursorOperations.Seek(BufferStart, BufferEnd, start, false); var end = ReadCursorOperations.Seek(begin, BufferEnd, length, false); return(new ReadableBuffer(begin, end)); }
/// <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)); }
public ReadCursor Move(ReadCursor cursor, long count) { if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count)); } return(ReadCursorOperations.Seek(cursor, BufferEnd, count, false)); }
/// <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)); }
/// <summary> /// Forms a slice out of the given <see cref="ReadableBuffer"/>, beginning at 'start', ending at the existing <see cref="ReadableBuffer"/>'s end. /// </summary> /// <param name="start">The start index at which to begin this slice.</param> public ReadableBuffer Slice(long start) { if (start == 0) { return(this); } var begin = ReadCursorOperations.Seek(BufferStart, BufferEnd, start, false); return(new ReadableBuffer(begin, BufferEnd)); }