public interface InputBuffer
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index)
Returns the character at the given index.
|
int |
codePointAt(int index)
Returns the Unicode code point starting at a given index
|
String |
extract(IndexRange range)
Constructs a new
String from all character covered by the given
IndexRange. |
String |
extract(int start,
int end)
Constructs a new
String from all character between the given
indices. |
String |
extractLine(int lineNumber)
Constructs a new
String containing all characters with the given
line number except for the trailing newline. |
int |
getLineCount()
Returns the number of lines in the input buffer.
|
IndexRange |
getLineRange(int lineNumber)
Get the index range matching a given line number
|
Position |
getPosition(int index)
Returns the line and column number of the character with the given index
encapsulated in a
Position object. |
int |
length() |
char charAt(int index)
If the index is greater than, or equal to, the buffer's length, this
method returns Chars.EOI
.
index
- the indexIllegalArgumentException
- index is negativeint codePointAt(int index)
If the index is greater than, or equal to, the buffer's length, this method returns -1.
index
- the indexIllegalArgumentException
- index is negativeString extract(int start, int end)
String
from all character between the given
indices. Invalid indices are automatically adjusted to their respective
boundary.start
- the start index (inclusively)end
- the end index (exclusively)String extract(IndexRange range)
String
from all character covered by the given
IndexRange.range
- the IndexRangePosition getPosition(int index)
Position
object. The very first character has
the line number 1 and the column number 1.index
- the index of the character to get the line number ofString extractLine(int lineNumber)
String
containing all characters with the given
line number except for the trailing newline.lineNumber
- the line number to getIndexRange getLineRange(int lineNumber)
lineNumber
- the line numberint getLineCount()
int length()