|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.util.io.FullyBufferedReader
public final class FullyBufferedReader
This is not a reader like e.g. FileReader. It rather reads the whole data untill 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 conviniently 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(java.io.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(java.lang.String str)
Find the string starting at the current input position |
int |
find(java.lang.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 |
java.lang.CharSequence |
getSubstring(int toPos)
Get the characters from the position marker to toPos. |
java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FullyBufferedReader(java.io.Reader reader) throws java.io.IOException
reader
- The source reader to load the data from
java.io.IOException
Method Detail |
---|
public final java.lang.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 java.lang.CharSequence getSubstring(int fromPos, int toPos)
fromPos
- first indextoPos
- second index
public final int getPosition()
public final void setPositionMarker(int pos)
pos
- public java.lang.String toString()
toString
in class java.lang.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(java.lang.String str)
str
- The string to search for
public final int find(java.lang.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 |