|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscanner.Scanner
A scanner is able to separate tokens from an input stream, following states defined in a finale state automata.
Constructor Summary | |
Scanner()
Creates a new scanner. |
|
Scanner(java.io.Reader stream)
Creates a new scanner to scan the specified stream |
|
Scanner(java.lang.String charStreamValue)
Creates a new scanner to scan the specified string. |
Method Summary | |
void |
addListener(ScannerListenerInterface listener)
Adds a listener to this scanner. |
java.lang.String |
getCurrentLine()
|
FinaleStateAutomata |
getFinaleStateAutomata()
Returns the current finale state automata currently used to separate tokens. |
CharStreamPosition |
getPosition()
Returns the position of the scanner if the input stream. |
boolean |
hasNext()
Returns true if there's any character left. |
void |
init(java.io.Reader readerStream)
Inits this scanner to be able to perform a scan on the given stream |
void |
init(java.lang.String charStreamValue)
Inits this scanner to be able to perform a scan on the given string |
Token |
nextToken()
Returns the next token encountered. |
void |
removeListener(ScannerListenerInterface listener)
Removes a listener from this scanner. |
void |
setFinaleStateAutomata(FinaleStateAutomata fsa)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Scanner(java.lang.String charStreamValue)
charStreamValue
- A string to be scanned.public Scanner(java.io.Reader stream)
stream
- The stream to be scanned.public Scanner()
Method Detail |
public void init(java.lang.String charStreamValue)
charStreamValue
- A string to be scanned.public void init(java.io.Reader readerStream)
readerStream
- The stream to be scanned.public void addListener(ScannerListenerInterface listener)
listener
- The listener to be added to this scanner.public void removeListener(ScannerListenerInterface listener)
listener
- The listener to be removed from this scanner.public Token nextToken() throws NoSuchTokenException
Thrown
- if there's no next valid token.
NoSuchTokenException
public boolean hasNext()
public FinaleStateAutomata getFinaleStateAutomata()
public void setFinaleStateAutomata(FinaleStateAutomata fsa)
public CharStreamPosition getPosition()
public java.lang.String getCurrentLine()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |