|
Hilbert II - Version 0.03.04 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream org.qedeq.kernel.utility.TextInput
This class provides convenient methods for parsing input. LATER mime 20050426: offer input stream constructor? LATER mime 20060330: decorate normal java.io.InputStream or other???
Field Summary | |
static char |
CR
Char marking end of input line. |
static int |
EOF
Char marking end of data. |
Constructor Summary | |
TextInput(File file)
Constructor using File source. |
|
TextInput(File file,
URL address)
Constructor using StringBuffer source. |
|
TextInput(String source)
Constructor using String source. |
|
TextInput(StringBuffer source)
Constructor using StringBuffer source. |
|
TextInput(URL url)
Constructor using URL source. |
Method Summary | |
URL |
getAddress()
Get address (or something to identify it) of input source. |
int |
getChar()
Reads a single character and does not change the reading position. |
int |
getChar(int skip)
Reads a single character and does not change the reading position. |
int |
getColumn()
Returns the current column number. |
String |
getLine()
Returns the current line. |
URL |
getLocalAddress()
Get local address (or something to identify it) of input source. |
int |
getMaximumPosition()
Returns the highest position number possible. |
int |
getPosition()
Returns the current position. |
int |
getRow()
Returns the current line number. |
boolean |
isEmpty()
Is there no data left for reading? |
boolean |
isEmpty(int skip)
Is there no data left for reading after skipping? |
int |
read()
Reads a single character and increments the reading position by one. |
String |
readCounter()
Reads the next (big) integer, leading whitespace is skipped. |
int |
readInverse()
Decrements the reading position by one and reads a single character. |
String |
readLetterDigitString()
Reads the next string containing only letters or digits, leading whitespace is skipped. |
String |
readNextAttributeValue()
Reads attribute value out of XML stream. |
String |
readNextXmlName()
Reads tag or attribute name out of XML stream. |
String |
readQuoted()
Reads the next quoted string, leading whitespace is skipped. |
String |
readString(int number)
Reads a given amount of characters and increments the reading position accordingly. |
void |
setColumn(int column)
Sets the current column position (and indirectly the position). |
void |
setPosition(int position)
Sets the current position (and indirectly the line number). |
void |
setRow(int row)
Sets the current line number (and indirectly the position). |
String |
showLinePosition()
Show reading position. |
void |
skipBackToBeginOfXmlTag()
Skip current position back to beginning of an XML tag. |
void |
skipForwardToEndOfXmlTag()
Skip current position forward to end of an XML tag. |
void |
skipWhiteSpace()
Skips white space, beginning from reading position. |
void |
skipWhiteSpaceInverse()
Skips white space, beginning from reading position. |
Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int EOF
public static final char CR
Constructor Detail |
public TextInput(File file) throws IOException
File
source.
file
- Data source.
IOException
- File reading failed.
NullPointerException
- One argument was a null pointer.public TextInput(File file, URL address) throws IOException
StringBuffer
source.
file
- Data source.address
- For identifying source.
IOException
- File reading failed.
NullPointerException
- Argument was a null pointer.public TextInput(StringBuffer source)
StringBuffer
source.
source
- data source
NullPointerException
- Argument was a null pointer.public TextInput(String source)
String
source.
source
- data source
NullPointerException
- Argument was a null pointer.public TextInput(URL url) throws IOException
URL
source.
url
- Data source.
IOException
- File reading failed.
NullPointerException
- One argument was a null pointer.Method Detail |
public final int read()
-1
is returned.
Otherwise a cast to char
gives the character read.
-1
is returned.public final int readInverse()
-1
is returned.
Otherwise a cast to char
gives the character read.
-1
is returned.public final String readString(int number)
number
- amount of characters to read
public final int getChar()
-1
is returned.
Otherwise a cast to char
gives the character read.
-1
is returnedpublic final int getChar(int skip)
-1
is returned. Otherwise a cast to char
gives the character read.
skip
- Offset from current reading position. Maybe negative.
-1
is returned.public final void skipWhiteSpace()
public final void skipWhiteSpaceInverse()
public final void skipBackToBeginOfXmlTag()
<tagName
.
IllegalArgumentException
- No begin of XML tag found.public final void skipForwardToEndOfXmlTag()
>
. Quoted data is skipped.
IllegalArgumentException
- No en of XML tag found.public final String readNextXmlName()
IllegalArgumentException
- Next non white space character is "="
or ">".public final String readNextAttributeValue()
public final boolean isEmpty()
public final boolean isEmpty(int skip)
skip
- Add this number to current position.
public final String readLetterDigitString()
IllegalArgumentException
- if no such characters could
be foundpublic final String readCounter()
Changes reading position.
IllegalArgumentException
- if no digits where found or
the number was to big for an int
public final String readQuoted()
IllegalArgumentException
- No correctly quoted string was found.public final int getRow()
public final int getColumn()
public final String getLine()
public final int getPosition()
public final int getMaximumPosition()
public final void setPosition(int position)
position
- Set current position to this value.public final void setRow(int row)
row
- Move to this line number.public final void setColumn(int column)
column
is out of range the minimum value (1) or the maximum possible column
value is taken.
column
- Move to this column. First column has the number one.public final URL getAddress()
public final URL getLocalAddress()
public final String showLinePosition()
|
Hilbert II - Version 0.03.04 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
©left GNU General Public Licence All Rights Reserved. |