@Test(expected = IndexOutOfBoundsException.class) public void testIndexPastEnd() { sequence.charAt(5); }
public char charAt(int index) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index " + index + " not in <0, " + length + ")"); } else if (index < getMinIndex()) { throw new IllegalStateException("Character lost, buffer too small."); } else { fillBuffer(index); if (index >= length) { throw new IndexOutOfBoundsException("End of stream."); } int relativeIndex = getRelativeIndex(index); char character = buffer.charAt(relativeIndex); return character; } }
ReaderCharSequence implements CharSequence { public char charAt(int index) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index " + index + " not in <0, " + length + ")"); } else if (index < getMinIndex()) { throw new IllegalStateException("Character lost, buffer too small."); } else { fillBuffer(index); if (index >= length) { throw new IndexOutOfBoundsException("End of stream."); } int relativeIndex = getRelativeIndex(index); char character = buffer.charAt(relativeIndex); return character; } } }
ReaderCharSequence implements CharSequence { public char charAt(int index) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index " + index + " not in <0, " + length + ")"); } else if (index < getMinIndex()) { throw new IllegalStateException("Character lost, buffer too small."); } else { fillBuffer(index); if (index >= length) { throw new IndexOutOfBoundsException("End of stream."); } int relativeIndex = getRelativeIndex(index); char character = buffer.charAt(relativeIndex); return character; } } ReaderCharSequence(Reader reader, int bufferLength, int length, 
			int lookahead);  ReaderCharSequence(Reader reader, int bufferLength, int length);  ReaderCharSequence(Reader reader, int bufferLength);  ReaderCharSequence(Reader reader); }
ReaderCharSequence implements CharSequence { public char charAt(int index) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index " + index + " not in <0, " + length + ")"); } else if (index < getMinIndex()) { throw new IllegalStateException("Character lost, buffer too small."); } else { fillBuffer(index); if (index >= length) { throw new IndexOutOfBoundsException("End of stream."); } int relativeIndex = getRelativeIndex(index); char character = buffer.charAt(relativeIndex); return character; } } ReaderCharSequence(Reader reader, int bufferLength, int length, 
			int lookahead);  ReaderCharSequence(Reader reader, int bufferLength, int length);  ReaderCharSequence(Reader reader, int bufferLength);  ReaderCharSequence(Reader reader); int length(); char charAt(int index); CharSequence subSequence(int start, int end); }
ReaderCharSequence implements CharSequence { public char charAt(int index) { if (index < 0 || index >= length) { throw new IndexOutOfBoundsException("Index " + index + " not in <0, " + length + ")"); } else if (index < getMinIndex()) { throw new IllegalStateException("Character lost, buffer too small."); } else { fillBuffer(index); if (index >= length) { throw new IndexOutOfBoundsException("End of stream."); } int relativeIndex = getRelativeIndex(index); char character = buffer.charAt(relativeIndex); return character; } } ReaderCharSequence(Reader reader, int bufferLength, int length, 
			int lookahead);  ReaderCharSequence(Reader reader, int bufferLength, int length);  ReaderCharSequence(Reader reader, int bufferLength);  ReaderCharSequence(Reader reader); int length(); char charAt(int index); CharSequence subSequence(int start, int end); static final int DEFAULT_BUFFER_LENGTH; static final int DEFAULT_LOOKAHEAD; static final int INFINITE_LENGTH; }