UrlRemoteFetcher

class UrlRemoteFetcher(connectTimeoutMillis: Int = DEFAULT_CONNECT_TIMEOUT_MILLIS, readTimeoutMillis: Int = DEFAULT_READ_TIMEOUT_MILLIS) : RemoteFetcher

RemoteFetcher that downloads content by opening a URL connection with finite timeouts, so an unreachable or stalled server fails the fetch instead of hanging a compilation. A FileNotFoundException, which the JDK raises both for missing local files and for HTTP 404 responses, is reported as RemoteFetchException.NotFound; any other I/O or URL failure as RemoteFetchException.

Parameters

connectTimeoutMillis

maximum time to establish the connection

readTimeoutMillis

maximum time to wait for data once connected

Constructors

Link copied to clipboard
constructor(connectTimeoutMillis: Int = DEFAULT_CONNECT_TIMEOUT_MILLIS, readTimeoutMillis: Int = DEFAULT_READ_TIMEOUT_MILLIS)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun fetchBytes(url: Url): ByteArray

Downloads the content at url.

Link copied to clipboard
open fun fetchText(url: Url): String

Downloads the content at url and decodes it as UTF-8 text.