TransformingResource
Transforms the bytes of resource on-the-fly.
If you set cacheBytes to false, consider providing your own implementation of length to avoid unnecessary transformations.
Warning: The transformation runs on the full content of resource, so it's not appropriate for large resources which can't be held in memory.
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.