Save This Page
Home » j2ssh-0.2.9-src » com.sshtools.daemon.util » [javadoc | source]
com.sshtools.daemon.util
public class: StringScanner [javadoc | source]
java.lang.Object
   com.sshtools.daemon.util.StringScanner

Direct Known Subclasses:
    StringExaminer

Simple scanner that allows to navigate over the characters of a string.
Field Summary
public static final  char END_REACHED     
protected  int length     
protected  int position     
protected  int pos_marker     
protected  char[] buffer     
Constructor:
 public StringScanner(String stringToScan) 
    Initialize the new instance with the string that should be scanned.
    Parameters:
    stringToScan -
Method from com.sshtools.daemon.util.StringScanner Summary:
atEnd,   endNotReached,   endReached,   getPosition,   hasNext,   length,   markPosition,   nextChar,   nextNoneWhitespaceChar,   peek,   restorePosition,   setPosition,   skip,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sshtools.daemon.util.StringScanner Detail:
 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() 
    Returns the current position in the string
 public boolean hasNext() 
    Returns true, if the scanner has not yet reached the end.
 protected int length() 
 public  void markPosition() 
    Remembers the current position for later use with restorePosition()
 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() 
    Restores the position to the value of the latest markPosition() call
 protected  void setPosition(int pos) 
 public  void skip(int count) 
    Moves the position pointer count characters. positive values move forwards, negative backwards. The position never becomes negative !
 public String toString() 
    Returns the string the scanner was initialized with