Class CharacterIterator
- java.lang.Object
-
- org.glassfish.jersey.uri.internal.CharacterIterator
-
final class CharacterIterator extends java.lang.Object
Iterator which iterates through the input string and returns characters from that string.
-
-
Constructor Summary
Constructors Constructor Description CharacterIterator(java.lang.String s)
Creates a new iterator initialized with the given input string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
current()
Returns character at the current position.java.lang.String
getInput()
Returns the input String on which thisiterator
operates.boolean
hasNext()
Determines whether there is next character in the iteration chain.char
next()
Returns next character in the iteration chain and increase the current position.char
peek()
Returns the next character without increasing the position.int
pos()
Returns the current internal position of the iterator.void
setPosition(int newPosition)
Changes the current position to the position.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Determines whether there is next character in the iteration chain.- Returns:
- True if there is a character which can be retrieved by
next()
, false otherwise.
-
next
public char next()
Returns next character in the iteration chain and increase the current position.- Returns:
- Next character.
- Throws:
java.lang.RuntimeException
- The method might throw exception when there is no more character to be retrieved.
-
peek
public char peek()
Returns the next character without increasing the position. The method does the same asnext()
but the position is not changed by calling this method.- Returns:
- Next character.
-
pos
public int pos()
Returns the current internal position of the iterator.- Returns:
- current position of the iterator
-
getInput
public java.lang.String getInput()
Returns the input String on which thisiterator
operates.- Returns:
- String which initialized this iterator.
-
setPosition
public void setPosition(int newPosition)
Changes the current position to the position.- Parameters:
newPosition
- New position for the iterator.
-
current
public char current()
Returns character at the current position.- Returns:
- Character from current position.
-
-