|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ourgrid.common.spec.io.CharReader
public class CharReader
This is a util Character reader that can read and unread characters and ignore lines.
Field Summary | |
---|---|
static char |
EOF_CHAR
|
static int |
MAX_UNREAD_CHAR_NUMBER
|
static java.lang.String |
UNIX_LINE_SEPARATOR
|
Constructor Summary | |
---|---|
CharReader(java.lang.String file)
Constructor of a character reader that uses the name of the file do be read. |
Method Summary | |
---|---|
void |
closeStreams()
Closes the reader properlly. |
int |
getActualLine()
|
char |
readChar()
Read a unique character at a time, including all the spetial structural character. |
void |
readLine()
Ignores from the actual position all the characters until the end of line (including it). |
char |
readNonBlankChar()
Read only non blank characters ignoring all "Character.isWhitespace()" excepts EOF and this.UNIX_LINE_SEPARATOR |
void |
unreadChar(char unwishedChar)
Unread a pre-defined ( this.MAX_UNREAD_CHAR_NUMBER ) number of read characters. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String UNIX_LINE_SEPARATOR
public static final char EOF_CHAR
public static final int MAX_UNREAD_CHAR_NUMBER
Constructor Detail |
---|
public CharReader(java.lang.String file) throws java.io.IOException
file
- the name of the file to be read
java.io.IOException
- If the file could not be found.Method Detail |
---|
public char readChar() throws java.io.IOException
java.io.IOException
public char readNonBlankChar() throws java.io.IOException
java.io.IOException
- if happens any reading problem.public void readLine() throws java.io.IOException
java.io.IOException
- if happens any reading problem.public void unreadChar(char unwishedChar) throws java.io.IOException
unwishedChar
- the temporary unwished char to be inserted back at
the reading queue.
java.io.IOException
- if this method is called more then the maximum times
permited (without any character be read)public void closeStreams() throws java.io.IOException
java.io.IOException
- if any problem related with the closing action
happens.public int getActualLine()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |