Class BasicHeaderIterator

    • Field Detail

      • allHeaders

        protected final Header[] allHeaders
        An array of headers to iterate over. Not all elements of this array are necessarily part of the iteration. This array will never be modified by the iterator. Derived implementations are expected to adhere to this restriction.
      • currentIndex

        protected int currentIndex
        The position of the next header in allHeaders. Negative if the iteration is over.
      • headerName

        protected String headerName
        The header name to filter by. null to iterate over all headers in the array.
    • Constructor Detail

      • BasicHeaderIterator

        public BasicHeaderIterator​(Header[] headers,
                                   String name)
        Creates a new header iterator.
        Parameters:
        headers - an array of headers over which to iterate
        name - the name of the headers over which to iterate, or null for any
    • Method Detail

      • findNext

        protected int findNext​(int pos)
        Determines the index of the next header.
        Parameters:
        pos - one less than the index to consider first, -1 to search for the first header
        Returns:
        the index of the next header that matches the filter name, or negative if there are no more headers
      • filterHeader

        protected boolean filterHeader​(int index)
        Checks whether a header is part of the iteration.
        Parameters:
        index - the index of the header to check
        Returns:
        true if the header should be part of the iteration, false to skip
      • hasNext

        public boolean hasNext()
        Description copied from interface: HeaderIterator
        Indicates whether there is another header in this iteration.
        Specified by:
        hasNext in interface HeaderIterator
        Specified by:
        hasNext in interface Iterator<Object>
        Returns:
        true if there is another header, false otherwise