|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Reader
fc.web.page.PageReader
public final class PageReader
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 | |
|---|---|
PageReader(File file)
Creates a reader using the platform's default character encoding. |
|
PageReader(File file,
String encoding)
Creates a reader with the specified non-null encoding. |
|
PageReader(Reader r)
Creates a new PageReader wrapping the specified reader |
|
| Method Summary | |
|---|---|
void |
close()
|
int |
getCol()
|
int |
getLine()
|
static void |
main(String[] args)
|
boolean |
markSupported()
|
boolean |
match(int target)
Tries to read/consumes the specified char and returns true if successful. |
boolean |
match(String target)
Tries to read/consumes the specified non-null string and returns true if successful. |
boolean |
matchIgnoreCase(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 PageReader(Reader r)
public PageReader(File file,
String encoding)
throws IOException
IOException
public PageReader(File file)
throws IOException
IOException| Method Detail |
|---|
public void close()
throws IOException
close in interface Closeableclose in class ReaderIOException
public int read()
throws IOException
read in class ReaderIOException
public int read(char[] buf,
int start,
int len)
throws IOException
read in class ReaderIOException
public void unread()
throws IOException
IOException
public void unread(int count)
throws IOException
IOException
public int peek()
throws IOException
IOException
public void skipWhitespace()
throws IOException
read will
return the next non-whitespace character (or EOF if there are no
more characters).
IOException
public boolean match(int target)
throws IOException
IOException
public boolean match(String target)
throws IOException
IOException
public boolean matchIgnoreCase(String target)
throws IOException
IOExceptionpublic boolean markSupported()
markSupported in class Readerpublic int getLine()
public int getCol()
public static void main(String[] args)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||