StringResource
Creates a Resource serving a String.
Constructors
Link copied to clipboard
constructor(source: AbsoluteUrl? = null, properties: Resource.Properties = Resource.Properties(), string: suspend () -> Try<String, ReadError>)
constructor(string: String, source: AbsoluteUrl? = null, properties: Resource.Properties = Resource.Properties())
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.