FallbackResource
class FallbackResource(originalResource: Resource, fallbackResourceFactory: (ReadError) -> Resource?) : Resource
Resource that will act as a proxy to a fallback resource if the originalResource errors out.
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
Wraps this resource into a buffer to improve reading performances.
fun Resource.buffered(resourceLength: Long? = null, bufferSize: Int = DEFAULT_BUFFER_SIZE): BufferingResource
Wraps this resource in a BufferingResource to improve reading performances.
Link copied to clipboard
Link copied to clipboard
Properties associated to the resource.
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?
Link copied to clipboard
Link copied to clipboard
Wraps this resource in a SynchronizedResource to protect the access from multiple threads.