|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsrc2xml.Source
public class Source
A class that implements a BufferedReader wrapping a FileReader. The Reader standard interface is too restricting, specially the mark() reset() part, very dangerous if calls are inadvertently nested. This class uses a stack to support nested marks.
Limitations:
Reader
Field Summary | |
---|---|
static int |
CHUNK_SIZE
Chunk size when buffering file [chars] |
static char |
INVALID_CHAR
|
Constructor Summary | |
---|---|
Source(java.lang.String path)
Class constructor |
Method Summary | |
---|---|
java.lang.CharSequence |
asCharSequence()
|
char |
currChar()
Get the current char. |
int |
currCharIdx()
Get the current char index in source. |
boolean |
Ended()
Check source end |
protected void |
finalize()
Class destructor Ensure release of used resources |
boolean |
nextChar()
Point the next char in source. |
char |
peekChar()
Peek the next char in source. |
java.lang.String |
read(int len)
Read a fixed length String from source |
void |
releaseMark()
Discard the previous mark. |
void |
restoreMark()
Restore a previously marked source position. |
void |
setMark()
Mark source position. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int CHUNK_SIZE
public static final char INVALID_CHAR
Constructor Detail |
---|
public Source(java.lang.String path) throws java.lang.Throwable
path
- The input file path
java.lang.Throwable
- If something's wrong during file bufferingStringBuilder
Method Detail |
---|
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.CharSequence asCharSequence()
public boolean nextChar()
public char currChar()
public int currCharIdx()
public char peekChar()
public java.lang.String read(int len)
len
- String length to read
String
public boolean Ended()
public void setMark()
public void restoreMark()
public void releaseMark()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |