internal static CharSequenceAdapter Copy(CharSequenceAdapter other) { return(new CharSequenceAdapter(other.sequence) { limit = other.limit, position = other.position, mark = other.mark }); }
public override CharBuffer Subsequence(int startIndex, int length) { if (startIndex < 0) { throw new ArgumentOutOfRangeException(nameof(startIndex)); } if (length < 0) { throw new ArgumentOutOfRangeException(nameof(length)); } if (startIndex > Remaining - length) // Checks for int overflow { throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_IndexLength); } CharSequenceAdapter result = Copy(this); result.position = position + startIndex; result.limit = position + startIndex + length; return(result); }
public override CharBuffer Subsequence(int startIndex, int length) { if (startIndex < 0) { throw new ArgumentOutOfRangeException(nameof(startIndex)); } if (length < 0) { throw new ArgumentOutOfRangeException(nameof(length)); } if (startIndex + length > Remaining) { throw new ArgumentOutOfRangeException("", $"{nameof(startIndex)} + {nameof(length)} > {nameof(Remaining)}"); } CharSequenceAdapter result = Copy(this); result.position = position + startIndex; result.limit = position + startIndex + length; return(result); }