de.esprit.common.util

## Class FastStringIterator

- java.lang.Object
- - de.esprit.common.util.FastStringIterator

-     public class FastStringIterator
      extends java.lang.Object

  This is a well tuned and very fast tokenizer for breaking lines into words.
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FastStringIterator()`
    `FastStringIterator(java.lang.String line)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `countTokens()` Counts the tokens of the current String by iterationg through it.
    `java.lang.String` | `getAndSkipRestOfLine()` Fetches the rest of line including the current token.
    `java.lang.String` | `getFromPreviousAndSkipRestOfLine()` Fetches the rest of line including the previous token.
    `int` | `getIndex()`
    `boolean` | `hasNext()` Tells whether there are still unread tokens in the line.
    `protected boolean` | `isBreakCharacter(char c)` Checks whether this character is used as a word boundary.
    `java.lang.String` | `next()` Returns the next token.
    `double` | `nextDouble()` Reads the next token as a double value
    `int` | `nextInt()` Reads the next token as an int value
    `void` | `setString(java.lang.String line)` Resets the iterator and places a new input line.
    `void` | `skip()` Skips the next token.
    `void` | `skipRestOfLine()` Skips all tokens until end of line is reached After this call `hasNext()` returns false.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FastStringIterator

          public FastStringIterator()

    - #### FastStringIterator

          public FastStringIterator(java.lang.String line)

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

      Tells whether there are still unread tokens in the line.

    - #### skipRestOfLine

          public void skipRestOfLine()

      Skips all tokens until end of line is reached After this call `hasNext()` returns false.

    - #### getFromPreviousAndSkipRestOfLine

          public java.lang.String getFromPreviousAndSkipRestOfLine()

      Fetches the rest of line including the previous token. After this call `hasNext()` returns false.

    - #### getAndSkipRestOfLine

          public java.lang.String getAndSkipRestOfLine()

      Fetches the rest of line including the current token. After this call `hasNext()` returns false.

    - #### getIndex

          public int getIndex()

    - #### next

          public java.lang.String next()

      Returns the next token.

    - #### skip

          public void skip()

      Skips the next token.

    - #### isBreakCharacter

          protected boolean isBreakCharacter(char c)

      Checks whether this character is used as a word boundary. It breaks the iteration but will appear as a token by its own. Note: this is a very frequent call!

    - #### nextDouble

          public double nextDouble()

      Reads the next token as a double value

    - #### nextInt

          public int nextInt()

      Reads the next token as an int value

    - #### setString

          public void setString(java.lang.String line)

      Resets the iterator and places a new input line. Allows this `FastStringIterator` instance to be reused again and again.

    - #### countTokens

          public int countTokens()

      Counts the tokens of the current String by iterationg through it. After having called this method the iterator is consumed.

Copyright © 2014 EsprIT-Systems. All Rights Reserved.