Skip to content

//readium-shared/org.readium.r2.shared.fetcher/HttpFetcher

HttpFetcher

[androidJvm]\ class HttpFetcher(client: HttpClient, baseUrl: String? = null) : Fetcher

Fetches remote resources through HTTP.

Since this fetcher is used when doing progressive download streaming (e.g. audiobook), the HTTP byte range requests are open-ended and reused. This helps to avoid issuing too many requests.

Parameters

androidJvm

client HTTP client used to perform HTTP requests.
baseUrl Base URL from which relative HREF are served.

Constructors

HttpFetcher [androidJvm]
fun HttpFetcher(client: HttpClient, baseUrl: String? = null)

Functions

Name Summary
close [androidJvm]
open suspend override fun close()
Closes this object and releases any resources associated with it. If the object is already closed then invoking this method has no effect.
get [androidJvm]
open fun get(href: String): Resource
Returns the Resource at the given href.
[androidJvm]
open override fun get(link: Link): Resource
Returns the Resource at the given link's HREF.
links [androidJvm]
open suspend override fun links(): List<Link>
Known resources available in the medium, such as file paths on the file system or entries in a ZIP archive. This list is not exhaustive, and additional unknown resources might be reachable.