public class BasicHeaderIterator extends Object implements HeaderIterator
HeaderIterator
.Modifier and Type | Field and Description |
---|---|
protected Header[] |
allHeaders
An array of headers to iterate over.
|
protected int |
currentIndex
The position of the next header in
allHeaders . |
protected String |
headerName
The header name to filter by.
|
Constructor and Description |
---|
BasicHeaderIterator(Header[] headers,
String name)
Creates a new header iterator.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
filterHeader(int index)
Checks whether a header is part of the iteration.
|
protected int |
findNext(int from)
Determines the index of the next header.
|
boolean |
hasNext()
Indicates whether there is another header in this iteration.
|
Object |
next()
Returns the next header.
|
Header |
nextHeader()
Obtains the next header from this iteration.
|
void |
remove()
Removing headers is not supported.
|
protected final Header[] allHeaders
protected int currentIndex
allHeaders
.
Negative if the iteration is over.protected String headerName
null
to iterate over all headers in the array.protected int findNext(int from)
from
- one less than the index to consider first,
-1 to search for the first headerprotected boolean filterHeader(int index)
index
- the index of the header to checktrue
if the header should be part of the
iteration, false
to skippublic boolean hasNext()
HeaderIterator
hasNext
in interface Iterator
hasNext
in interface HeaderIterator
true
if there is another header,
false
otherwisepublic Header nextHeader() throws NoSuchElementException
nextHeader
in interface HeaderIterator
NoSuchElementException
- if there are no more headerspublic final Object next() throws NoSuchElementException
nextHeader
, but not type-safe.next
in interface Iterator
NoSuchElementException
- if there are no more headerspublic void remove() throws UnsupportedOperationException
remove
in interface Iterator
UnsupportedOperationException
- alwaysCopyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.