|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--nl.bluering.CoolFileHandle
A CoolFileHandle can be used to read files. It is cool because it can tokenize the file: with get you can ask for a token that matches the given regular expression. This makes it ideal for building parsers with. Another cool feature is that you can rewind the file to a previous position (also very handy for parsing).
| Constructor Summary | |
CoolFileHandle(java.io.File ff)
parses the given file. |
|
CoolFileHandle(java.lang.String text)
creates a CFH for parsing the given string. |
|
| Method Summary | |
void |
buffer(boolean on)
buffer(true) enables buffering buffer(false) disables buffering. |
void |
close()
closes the CFH. |
boolean |
EOF()
|
java.lang.String |
get(Expression pattern)
get returns a part of the stream that matches the given regular expression. |
int |
getpos()
get the current position. |
boolean |
lastin(java.lang.String s)
|
static void |
main(java.lang.String[] ps)
test the class. |
void |
pushback(java.lang.String s)
|
void |
setpos(int i)
with setpos you can return to a previous position. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CoolFileHandle(java.lang.String text)
throws java.lang.Exception
text - the string to parsejava.lang.Exception - in case something went wrong with the file.
public CoolFileHandle(java.io.File ff)
throws java.lang.Exception
ff - the file to openjava.lang.Exception - in case something went wrong with the file.| Method Detail |
public void close()
public boolean EOF()
public int getpos()
public void setpos(int i)
i - an integer that you got from getpos()public void buffer(boolean on)
public boolean lastin(java.lang.String s)
public void pushback(java.lang.String s)
public java.lang.String get(Expression pattern)
throws java.lang.Exception
java.lang.Exception - if a technical error with the current file happenedpublic static void main(java.lang.String[] ps)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||