|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
fc.util.pagetemplate.TemplateReader
public final class TemplateReader
A Reader suitable for lexing. Supports all of: peek
,
read
and unread
. (no JDK 1.5 reader class has
all of those). Mark/reset is not supported because it's too complex to
implement given the current fixed-buffer implementation of this
class. (on the flip-side this implementation does allow to read
very large files without risk of running out of JDK memory).
Note 1: If this class is invoked from the command line, setting the dbg
flag in the code to true
is useful.
Constructor Summary | |
---|---|
TemplateReader(java.io.File file)
Creates a reader using the UTF-8 encoding. |
|
TemplateReader(java.io.File file,
java.lang.String encoding)
Creates a reader with the specified non-null encoding. |
|
TemplateReader(java.io.Reader r)
Creates a new TemplateReader wrapping the specified reader |
Method Summary | |
---|---|
void |
close()
|
int |
getCol()
|
int |
getLine()
|
void |
insertIntoStream(java.io.File file)
Useful for inserting included files into the stream and then parsing that content in-line with the rest of the file. |
void |
insertIntoStream(java.io.Reader r)
Useful for inserting included files into the stream and then parsing that content in-line with the rest of the file. |
static void |
main(java.lang.String[] args)
|
boolean |
markSupported()
|
boolean |
match(int target)
Tries to read/consumes the specified char and returns true if successful. |
boolean |
match(java.lang.String target)
Tries to read/consumes the specified non-null string and returns true if successful. |
boolean |
matchIgnoreCase(java.lang.String target)
|
int |
peek()
|
int |
read()
|
int |
read(char[] buf,
int start,
int len)
|
void |
skipWhitespace()
Skips all whitespace characters such that the next read will
return the next non-whitespace character (or EOF if there are no
more characters). |
void |
unread()
Unreads the current character (which could be EOF) so that the next read will return the current character (or EOF) again. |
void |
unread(int count)
Unreads the specified number of characters |
Methods inherited from class java.io.Reader |
---|
mark, read, read, ready, reset, skip |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateReader(java.io.Reader r) throws java.io.IOException
java.io.IOException
public TemplateReader(java.io.File file, java.lang.String encoding) throws java.io.IOException
java.io.IOException
public TemplateReader(java.io.File file) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.Reader
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public int read(char[] buf, int start, int len) throws java.io.IOException
read
in class java.io.Reader
java.io.IOException
public void unread() throws java.io.IOException
java.io.IOException
public void unread(int count) throws java.io.IOException
java.io.IOException
public void insertIntoStream(java.io.File file) throws java.io.IOException
java.io.IOException
public void insertIntoStream(java.io.Reader r) throws java.io.IOException
java.io.IOException
public int peek() throws java.io.IOException
java.io.IOException
public void skipWhitespace() throws java.io.IOException
read
will
return the next non-whitespace character (or EOF if there are no
more characters).
java.io.IOException
public boolean match(int target) throws java.io.IOException
java.io.IOException
public boolean match(java.lang.String target) throws java.io.IOException
java.io.IOException
public boolean matchIgnoreCase(java.lang.String target) throws java.io.IOException
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.Reader
public int getLine()
public int getCol()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |