|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.parboiled.buffers.DefaultInputBuffer
public class DefaultInputBuffer
Immutable default implementation of an InputBuffer.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.parboiled.buffers.InputBuffer |
|---|
InputBuffer.Position |
| Field Summary | |
|---|---|
protected char[] |
buffer
|
protected int |
length
|
protected int[] |
newlines
|
| Constructor Summary | |
|---|---|
DefaultInputBuffer(char[] buffer)
Constructs a new DefaultInputBuffer wrapping the given char array. |
|
| Method Summary | |
|---|---|
protected void |
buildNewlines()
|
char |
charAt(int index)
Returns the character at the given index. |
java.lang.String |
extract(int start,
int end)
Constructs a new String from all character between the given indices. |
java.lang.String |
extractLine(int lineNumber)
Constructs a new String containing all characters with the given line number except for the trailing
newline. |
protected static int |
getLine0(int[] newlines,
int index)
|
int |
getLineCount()
Returns the number of lines in the input buffer. |
InputBuffer.Position |
getPosition(int index)
Returns the line and column number of the character with the given index encapsulated in a InputBuffer.Position
object. |
boolean |
test(int index,
char[] characters)
Determines whether the characters starting at the given index match the ones from the given array (in order). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final int length
protected final char[] buffer
protected int[] newlines
| Constructor Detail |
|---|
public DefaultInputBuffer(char[] buffer)
buffer - the chars| Method Detail |
|---|
public char charAt(int index)
InputBufferChars.EOI.
charAt in interface InputBufferindex - the index
public boolean test(int index,
char[] characters)
InputBuffer
test in interface InputBufferindex - the index into the input buffer where to start the comparisoncharacters - the characters to test against the input buffer
public java.lang.String extract(int start,
int end)
InputBufferString from all character between the given indices.
Invalid indices are automatically adjusted to their respective boundary.
extract in interface InputBufferstart - the start index (inclusively)end - the end index (exclusively)
public InputBuffer.Position getPosition(int index)
InputBufferInputBuffer.Position
object. The very first character has the line number 1 and the column number 1.
getPosition in interface InputBufferindex - the index of the character to get the line number of
protected static int getLine0(int[] newlines,
int index)
public java.lang.String extractLine(int lineNumber)
InputBufferString containing all characters with the given line number except for the trailing
newline.
extractLine in interface InputBufferlineNumber - the line number to get
public int getLineCount()
InputBuffer
getLineCount in interface InputBufferprotected void buildNewlines()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||