public void seek(int index) {if (index == currentCharIndex) {return;}if (index > currentCharIndex) {sync(index - currentCharIndex);index = Math.min(index, getBufferStartIndex() + n - 1);}int i = index - getBufferStartIndex();if ( i < 0 ) {throw new IllegalArgumentException("cannot seek to negative index " + index);}else if (i >= n) {throw new UnsupportedOperationException("seek to index outside buffer: "+index+" not in "+getBufferStartIndex()+".."+(getBufferStartIndex()+n));}p = i;currentCharIndex = index;if (p == 0) {lastChar = lastCharBufferStart;}else {lastChar = data[p-1];}}
public virtual void Seek(int index){if (index == currentCharIndex){return;}if (index > currentCharIndex){Sync(index - currentCharIndex);index = Math.Min(index, BufferStartIndex + n - 1);}int i = index - BufferStartIndex;if (i < 0){throw new ArgumentException("cannot seek to negative index " + index);}else{if (i >= n){throw new NotSupportedException("seek to index outside buffer: " + index + " not in " + BufferStartIndex + ".." + (BufferStartIndex + n));}}p = i;currentCharIndex = index;if (p == 0){lastChar = lastCharBufferStart;}else{lastChar = data[p - 1];}}