|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.util.io.FullyBufferedReader
public final class FullyBufferedReader
This is not a reader like e.g. FileReader. It rather reads the whole data until the end from a source reader into memory and besides that it maintains the current position (like a reader) it provides String like methods which conveniently let you navigate (usually forward) in the stream.
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 Summary | |
---|---|
FullyBufferedReader(Reader reader)
Read all the data from the resource into memory. |
Method Summary | |
---|---|
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 |
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FullyBufferedReader(Reader reader) throws IOException
reader
- The source reader to load the data from
IOException
Method Detail |
---|
public 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 included
public final CharSequence getSubstring(int fromPos, int toPos)
fromPos
- first indextoPos
- second index
public final int getPosition()
public final void setPositionMarker(int pos)
pos
- public String toString()
toString
in class Object
public final void countLinesTo(int end)
end
- End indexpublic final int find(char ch)
ch
- The char to search for
public final int find(char ch, int startPos)
ch
- The char to search forstartPos
- The index to start at
public final int find(String str)
str
- The string to search for
public final int find(String str, int startPos)
str
- The string to search forstartPos
- The index to start at
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 position
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |