public final class FullyBufferedReader extends Object
Because the source data are expected to be text, the line and column numbers are maintained as
well for location precise error messages. But it does NOT automatically update the line and
column numbers. You must call countLinesTo(int)
Constructor and Description |
---|
FullyBufferedReader(Reader reader)
Read all the data from the resource into memory.
|
FullyBufferedReader(String input)
Construct.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int pos)
Get the character at the position provided
|
void |
countLinesTo(int end)
Counts lines starting where we last left off up to the index provided.
|
int |
find(char ch)
Find a char starting at the current input position
|
int |
find(char ch,
int startPos)
Find a char starting at the position provided
|
int |
find(String str)
Find the string starting at the current input position
|
int |
find(String str,
int startPos)
Find the string starting at the position provided
|
int |
findOutOfQuotes(char ch,
int startPos)
Find a char starting at the position provided.
|
int |
findOutOfQuotes(char ch,
int startPos,
char quotationChar)
Find a char starting at the position provided.
|
int |
getColumnNumber()
Get the column number.
|
int |
getLineNumber()
Get the line number.
|
int |
getPosition()
Gets the current input position
|
CharSequence |
getSubstring(int toPos)
Get the characters from the position marker to toPos.
|
CharSequence |
getSubstring(int fromPos,
int toPos)
Get the characters from in between both positions including the char at fromPos, excluding
the char at toPos
|
void |
setPosition(int pos)
Position the reader at the index provided.
|
void |
setPositionMarker(int pos)
Remember the current position in markup
|
int |
size()
Get the number of character read from the source resource.
|
String |
toString() |
public FullyBufferedReader(Reader reader) throws IOException
reader
- The source reader to load the data fromIOException
public FullyBufferedReader(String input)
input
- The source stringpublic final CharSequence getSubstring(int toPos)
If toPos < 0, than get all data from the position marker until the end. If toPos less than the current position marker than return an empty string ""
toPos
- Index of first character not includedpublic final CharSequence getSubstring(int fromPos, int toPos)
fromPos
- first indextoPos
- second indexpublic final int getPosition()
public final void setPositionMarker(int pos)
pos
- public String toString()
public final void countLinesTo(int end)
end
- End indexpublic final int find(char ch)
ch
- The char to search forpublic final int find(char ch, int startPos)
ch
- The char to search forstartPos
- The index to start atpublic final int find(String str)
str
- The string to search forpublic final int find(String str, int startPos)
str
- The string to search forstartPos
- The index to start atpublic int findOutOfQuotes(char ch, int startPos) throws ParseException
ch
- The char to search forstartPos
- The index to start atParseException
public int findOutOfQuotes(char ch, int startPos, char quotationChar) throws ParseException
ch
- The char to search forstartPos
- The index to start atquotationChar
- The current quotation char. Must be ' or ", otherwise will be ignored.ParseException
public final void setPosition(int pos)
pos
- The new current positionpublic final int getColumnNumber()
public final int getLineNumber()
public final int size()
public final char charAt(int pos)
pos
- The positionCopyright © 2006–2022 Apache Software Foundation. All rights reserved.