PublicationContentIterator

class PublicationContentIterator(manifest: Manifest, container: Container<Resource>, services: PublicationServicesHolder, startLocator: Locator?, resourceContentIteratorFactories: List<ResourceContentIteratorFactory>) : Content.Iterator

A composite Content.Iterator which iterates through a whole manifest and delegates the iteration inside a given resource to media type-specific iterators.

Parameters

manifest

The Manifest of the publication which will be iterated through.

startLocator

Starting Locator in the publication.

resourceContentIteratorFactories

List of ResourceContentIteratorFactory which will be used to create the iterator for each resource. The factories are tried in order until there's a match.

Constructors

Link copied to clipboard
constructor(manifest: Manifest, container: Container<Resource>, services: PublicationServicesHolder, startLocator: Locator?, resourceContentIteratorFactories: List<ResourceContentIteratorFactory>)

Functions

Link copied to clipboard
open suspend operator override fun hasNext(): Boolean

Returns true if the iterator has a next element, suspending the caller while processing it.

Link copied to clipboard
open suspend override fun hasPrevious(): Boolean

Returns true if the iterator has a previous element, suspending the caller while processing it.

Link copied to clipboard
open operator override fun next(): Content.Element

Retrieves the element computed by a preceding call to hasNext, or throws an IllegalStateException if hasNext was not invoked. This method should only be used in pair with hasNext.

Link copied to clipboard
open suspend fun nextOrNull(): Content.Element?

Advances to the next item and returns it, or null if we reached the end.

Link copied to clipboard
open override fun previous(): Content.Element

Retrieves the element computed by a preceding call to hasPrevious, or throws an IllegalStateException if hasPrevious was not invoked. This method should only be used in pair with hasPrevious.

Link copied to clipboard
open suspend fun previousOrNull(): Content.Element?

Advances to the previous item and returns it, or null if we reached the beginning.