| Method from com.sshtools.daemon.util.StringScanner Detail: |
public boolean atEnd() {
return (endReached(this.peek()));
}
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) {
return (!endReached(character));
}
Returns true, if the given character does not indicate that the
end of the scanned string si reached. |
public boolean endReached(char character) {
return (character == END_REACHED);
}
Returns true, if the given character indicates that the end of the
scanned string is reached. |
public int getPosition() {
return position;
}
Returns the current position in the string |
public boolean hasNext() {
return !this.atEnd();
}
Returns true, if the scanner has not yet reached the end. |
protected int length() {
return length;
}
|
public void markPosition() {
pos_marker = position;
}
Remembers the current position for later use with restorePosition() |
public char nextChar() {
char next = this.peek();
if (endNotReached(next)) {
this.skip(1);
}
return next;
}
Returns the character at the current position and increments the
position afterwards by 1. |
public char nextNoneWhitespaceChar() {
char next = this.nextChar();
while ((endNotReached(next)) && (Character.isWhitespace(next))) {
next = this.nextChar();
}
return next;
}
Returns the next character that is no whitespace and leaves the position
pointer one character after the returned one. |
public char peek() {
return ((position < length()) ? buffer[position] : END_REACHED);
}
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() {
this.setPosition(pos_marker);
}
Restores the position to the value of the latest markPosition() call |
protected void setPosition(int pos) {
if ((pos >= 0) && (pos < = this.length())) {
position = pos;
}
}
|
public void skip(int count) {
position += count;
if (position < 0) {
position = 0;
}
}
Moves the position pointer count characters. positive values move
forwards, negative backwards. The position never becomes negative ! |
public String toString() {
return new String(buffer);
}
Returns the string the scanner was initialized with |