Package-level declarations

Types

Link copied to clipboard

Represents an absolute Uniform Resource Locator.

Link copied to clipboard
interface Closeable

A Closeable is an object holding closeable resources, such as open files or streams.

Link copied to clipboard
class CoroutineQueue(dispatcher: CoroutineDispatcher = Dispatchers.Main)

CoroutineScope-like util to execute coroutines in a sequential order (FIFO). As with a SupervisorJob, children can be cancelled or fail independently one from the other.

Link copied to clipboard
class CursorList<E>(list: List<E> = emptyList(), index: Int = -1) : List<E>

A List with a mutable cursor index.

Link copied to clipboard
class DebugError(val message: String, val cause: Error? = null) : Error

A basic Error implementation with a debug message.

Link copied to clipboard
sealed class Either<out A, out B>

Generic wrapper to store two mutually exclusive types.

Link copied to clipboard
interface Error

Describes an error.

Link copied to clipboard
class ErrorException(val error: Error) : Exception

A throwable caused by an Error.

Link copied to clipboard
value class FileExtension(val value: String)
Link copied to clipboard

A moment in time.

Link copied to clipboard
object InstantSerializer : KSerializer<Instant>

A serializer for Instant that uses the ISO-8601 representation.

Link copied to clipboard
@Serializable(with = Language.Serializer::class)
class Language(code: String)

Represents a language with its region.

Link copied to clipboard
open class MapCompanion<K, E>(map: Map<K, E>)

Encapsulates a Map into a more limited query API.

Link copied to clipboard
open class MapWithDefaultCompanion<K, E>(map: Map<K, E>, val default: E) : MapCompanion<K, E>

Extends a MapCompanion by adding a default value as a fallback.

Link copied to clipboard
interface MemoryObserver

A memory observer reacts to a device reclaiming memory by releasing unused resources.

Link copied to clipboard

Represents a relative Uniform Resource Locator.

Link copied to clipboard
class SingleJob(scope: CoroutineScope)

Runs a single coroutine job at a time.

Link copied to clipboard
class ThrowableError<E : Throwable>(val throwable: E) : Error

An error caused by the catch of a throwable.

Link copied to clipboard
sealed class Try<out Success, out Failure>

A Result type which can be used as a return type.

Link copied to clipboard
sealed class Url : Parcelable

A Uniform Resource Locator.

Properties

Link copied to clipboard

Returns true if a lazy property reference has been initialized, or if the property is not lazy.

Functions

Link copied to clipboard

Appends this file extension to filename.

Link copied to clipboard
fun <S, F> Try<S, F>.checkSuccess(): S

Returns value in case of success and throws an IllegalStateException in case of failure.

Link copied to clipboard
inline fun <R, S, F> Try<S, F>.flatMap(transform: (value: S) -> Try<R, F>): Try<R, F>

Returns the encapsulated result of the given transform function applied to the encapsulated value if this instance represents success or the original encapsulated value if it is failure.

Link copied to clipboard

According to the EPUB specification, the HREFs in the EPUB package must be valid URLs (so percent-encoded). Unfortunately, many EPUBs don't follow this rule, and use invalid HREFs such as my chapter.html or /dir/my chapter.html.

Link copied to clipboard

Creates an Url from a legacy HREF.

Link copied to clipboard
fun <T> Map<Url, T>.getEquivalent(key: Url): T?

Returns the value of the first key matching key after normalization.

Link copied to clipboard
fun <R, S : R, F> Try<S, F>.getOrDefault(defaultValue: R): R

Returns the encapsulated value if this instance represents success or the defaultValue if it is failure.

Link copied to clipboard
inline fun <R, S : R, F> Try<S, F>.getOrElse(onFailure: (exception: F) -> R): R

Returns the encapsulated value if this instance represents success or the result of onFailure function for the encapsulated value if it is failure.

Link copied to clipboard
fun <S, F : Throwable> Try<S, F>.getOrThrow(): S

Returns the encapsulated value if this instance represents success or throws the encapsulated Throwable exception if it is failure.

Link copied to clipboard

Returns whether the receiver is equivalent to the given url after normalization.

Link copied to clipboard
Link copied to clipboard

Convenience function to get the description of an error with its cause.

Link copied to clipboard
Link copied to clipboard
fun Url.toUri(): Uri
Link copied to clipboard
fun Uri.toUrl(): Url?
fun URI.toUrl(): Url?
fun URL.toUrl(): Url?

fun File.toUrl(isDirectory: Boolean): AbsoluteUrl

Creates a URL pointing to this File which must denote an absolute path.

Link copied to clipboard
inline fun <R, S : R, F, T> Try<S, F>.tryRecover(transform: (exception: F) -> Try<R, T>): Try<R, T>

Returns the encapsulated result of the given transform function applied to the encapsulated value if this instance represents failure or the original encapsulated value if it is success.

Link copied to clipboard
inline fun <T : Closeable?, R> T.use(block: (T) -> R): R

Executes the given block function on this resource and then closes it down correctly whether an exception is thrown or not.