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#token
sequences 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.String
HTTP_SEPARATORS
The 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 boolean
hasNext()
Indicates whether there is another token in this iteration.java.lang.Object
next()
Returns the next token.java.lang.String
nextToken()
Obtains the next token from this iteration.void
remove()
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:TokenIterator
Indicates whether there is another token in this iteration.- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.Object>
- Specified by:
hasNext
in interfaceTokenIterator
- Returns:
true
if there is another token,false
otherwise
-
nextToken
public java.lang.String nextToken() throws java.util.NoSuchElementException, ParseException
Obtains the next token from this iteration.- Specified by:
nextToken
in 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, ParseException
Returns the next token. Same asnextToken()
, but with generic return type.- Specified by:
next
in 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.UnsupportedOperationException
Removing tokens is not supported.- Specified by:
remove
in interfacejava.util.Iterator<java.lang.Object>
- Throws:
java.lang.UnsupportedOperationException
- always
-
-