Package org.apache.http.message
Class BasicTokenIterator
- java.lang.Object
-
- org.apache.http.message.BasicTokenIterator
-
- All Implemented Interfaces:
java.util.Iterator<java.lang.Object>,TokenIterator
public class BasicTokenIterator extends java.lang.Object implements TokenIterator
Basic implementation of aTokenIterator. This implementation parses#tokensequences as defined by RFC 2616, section 2. It extends that definition somewhat beyond US-ASCII.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHTTP_SEPARATORSThe HTTP separator characters.
-
Constructor Summary
Constructors Constructor Description BasicTokenIterator(HeaderIterator headerIterator)Creates a new instance ofBasicTokenIterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Indicates whether there is another token in this iteration.java.lang.Objectnext()Returns the next token.java.lang.StringnextToken()Obtains the next token from this iteration.voidremove()Removing tokens is not supported.
-
-
-
Field Detail
-
HTTP_SEPARATORS
public static final java.lang.String HTTP_SEPARATORS
The HTTP separator characters. Defined in RFC 2616, section 2.2.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicTokenIterator
public BasicTokenIterator(HeaderIterator headerIterator)
Creates a new instance ofBasicTokenIterator.- Parameters:
headerIterator- the iterator for the headers to tokenize
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:TokenIteratorIndicates whether there is another token in this iteration.- Specified by:
hasNextin interfacejava.util.Iterator<java.lang.Object>- Specified by:
hasNextin interfaceTokenIterator- Returns:
trueif there is another token,falseotherwise
-
nextToken
public java.lang.String nextToken() throws java.util.NoSuchElementException, ParseExceptionObtains the next token from this iteration.- Specified by:
nextTokenin interfaceTokenIterator- Returns:
- the next token in this iteration
- Throws:
java.util.NoSuchElementException- if the iteration is already overParseException- if an invalid header value is encountered
-
next
public final java.lang.Object next() throws java.util.NoSuchElementException, ParseExceptionReturns the next token. Same asnextToken(), but with generic return type.- Specified by:
nextin interfacejava.util.Iterator<java.lang.Object>- Returns:
- the next token in this iteration
- Throws:
java.util.NoSuchElementException- if there are no more tokensParseException- if an invalid header value is encountered
-
remove
public final void remove() throws java.lang.UnsupportedOperationExceptionRemoving tokens is not supported.- Specified by:
removein interfacejava.util.Iterator<java.lang.Object>- Throws:
java.lang.UnsupportedOperationException- always
-
-