Package-level declarations

Types

Link copied to clipboard
interface AccessError : Error

Marker interface for source-specific access errors.

Link copied to clipboard
class CompositeContainer<E : Readable>(containers: List<Container<E>>) : Container<E>

Concatenates several containers.

Link copied to clipboard
interface Container<out E : Readable> : Iterable<Url> , Closeable

A container provides access to a list of Readable entries.

Link copied to clipboard
sealed class DecodeError : Error

Errors produced when trying to decode content.

Link copied to clipboard

A Container providing no entries at all.

Link copied to clipboard
interface Readable : Closeable

Acts as a proxy to an actual data source by handling read access.

Link copied to clipboard
sealed class ReadError : Error

Errors occurring while reading a resource.

Link copied to clipboard
class ReadException(val error: ReadError) : IOException

An IOException wrapping a ReadError.

Link copied to clipboard

Functions

Link copied to clipboard
fun Readable.asInputStream(range: LongRange? = null, wrapError: (ReadError) -> IOException = { ReadException(it) }): InputStream

Wraps a Readable into an InputStream.

Link copied to clipboard

Returns a new Readable accessing the same data but not owning them.

Link copied to clipboard
fun Readable.buffered(contentLength: Long? = null, bufferSize: Int = DEFAULT_BUFFER_SIZE): Readable

Wraps this resource into a buffer to improve reading performances.

Link copied to clipboard
suspend fun <R, S> S.decode(block: (value: S) -> R, wrapError: (Exception) -> Error): Try<R, DecodeError>

Decodes receiver properly wrapping exceptions into DecodeErrors.

Link copied to clipboard

Reads the full content as a Bitmap.

Link copied to clipboard

Content parsed from JSON.

Link copied to clipboard
inline suspend fun <R> Try<ByteArray, ReadError>.decodeOrElse(decode: (value: ByteArray) -> Try<R, DecodeError>, recover: (DecodeError.Decoding) -> R): Try<R, ReadError>
Link copied to clipboard
inline suspend fun <R> Try<ByteArray, ReadError>.decodeOrNull(decode: (value: ByteArray) -> Try<R, DecodeError>): R?
Link copied to clipboard

Readium Web Publication Manifest parsed from the content.

Readium Web Publication Manifest parsed from JSON.

Link copied to clipboard
suspend fun ByteArray.decodeString(charset: Charset = Charsets.UTF_8): Try<String, DecodeError>

Content as plain text.

Link copied to clipboard

Content as an XML document.

Link copied to clipboard
inline suspend fun <R> Readable.readDecodeOrElse(decode: (value: ByteArray) -> Try<R, DecodeError>, recover: (ReadError) -> R): R
inline suspend fun <R> Readable.readDecodeOrElse(decode: (value: ByteArray) -> Try<R, DecodeError>, recoverRead: (ReadError) -> R, recoverDecode: (DecodeError.Decoding) -> R): R
Link copied to clipboard
inline suspend fun <R> Readable.readDecodeOrNull(decode: (value: ByteArray) -> Try<R, DecodeError>): R?
inline suspend fun <S> Container<Readable>.readDecodeOrNull(url: Url, decode: (ByteArray) -> Try<S, DecodeError>): S?
Link copied to clipboard
inline suspend fun Readable.readOrElse(recover: (ReadError) -> ByteArray): ByteArray