| java.lang.Object com.sshtools.daemon.util.StringScanner
All known Subclasses: com.sshtools.daemon.util.StringExaminer,
StringScanner | public class StringScanner (Code) | | Simple scanner that allows to navigate over the characters of a string.
author: Manfred Duchrow version: 1.1 |
Constructor Summary | |
public | StringScanner(String stringToScan) Initialize the new instance with the string that should be scanned. |
Method Summary | |
public boolean | atEnd() Returns true, if the scanner has reached the end and a further
invocation of nextChar() would return the END_REACHED character. | public boolean | endNotReached(char character) Returns true, if the given character does not indicate that the
end of the scanned string si reached. | public boolean | endReached(char character) Returns true, if the given character indicates that the end of the
scanned string is reached. | public int | getPosition() | public boolean | hasNext() Returns true, if the scanner has not yet reached the end. | protected int | length() | public void | markPosition() | public char | nextChar() Returns the character at the current position and increments the
position afterwards by 1. | public char | nextNoneWhitespaceChar() Returns the next character that is no whitespace and leaves the position
pointer one character after the returned one. | public char | peek() Returns the character at the current position without changing the
position, that is subsequent calls to this method return always the
same character. | public void | restorePosition() | protected void | setPosition(int pos) | public void | skip(int count) Moves the position pointer count characters. | public String | toString() |
END_REACHED | final public static char END_REACHED(Code) | | |
buffer | protected char[] buffer(Code) | | |
length | protected int length(Code) | | |
pos_marker | protected int pos_marker(Code) | | |
position | protected int position(Code) | | |
StringScanner | public StringScanner(String stringToScan)(Code) | | Initialize the new instance with the string that should be scanned.
Parameters: stringToScan - |
atEnd | public boolean atEnd()(Code) | | Returns true, if the scanner has reached the end and a further
invocation of nextChar() would return the END_REACHED character.
|
endNotReached | public boolean endNotReached(char character)(Code) | | Returns true, if the given character does not indicate that the
end of the scanned string si reached.
Parameters: character - |
endReached | public boolean endReached(char character)(Code) | | Returns true, if the given character indicates that the end of the
scanned string is reached.
Parameters: character - |
getPosition | public int getPosition()(Code) | | Returns the current position in the string
|
hasNext | public boolean hasNext()(Code) | | Returns true, if the scanner has not yet reached the end.
|
length | protected int length()(Code) | | |
markPosition | public void markPosition()(Code) | | Remembers the current position for later use with restorePosition()
|
nextChar | public char nextChar()(Code) | | Returns the character at the current position and increments the
position afterwards by 1.
|
nextNoneWhitespaceChar | public char nextNoneWhitespaceChar()(Code) | | Returns the next character that is no whitespace and leaves the position
pointer one character after the returned one.
|
peek | public char peek()(Code) | | Returns the character at the current position without changing the
position, that is subsequent calls to this method return always the
same character.
|
restorePosition | public void restorePosition()(Code) | | Restores the position to the value of the latest markPosition() call
|
setPosition | protected void setPosition(int pos)(Code) | | |
skip | public void skip(int count)(Code) | | Moves the position pointer count characters. positive values move
forwards, negative backwards. The position never becomes negative !
Parameters: count - |
toString | public String toString()(Code) | | Returns the string the scanner was initialized with
|
|
|