//readium-shared/org.readium.r2.shared.fetcher/ProxyResource
ProxyResource¶
[androidJvm]\ abstract class ProxyResource(resource: Resource) : Resource
A base class for a Resource which acts as a proxy to another one.
Every function is delegating to the proxied resource, and subclasses should override some of them.
Constructors¶
ProxyResource | [androidJvm] fun ProxyResource(resource: Resource) |
Functions¶
Name | Summary |
---|---|
close | [androidJvm] open suspend override fun close() Closes this object and releases any resources associated with it. If the object is already closed then invoking this method has no effect. |
length | [androidJvm] open suspend override fun length(): ResourceTry<Long> Returns data length from metadata if available, or calculated from reading the bytes otherwise. |
link | [androidJvm] open suspend override fun link(): Link Returns the link from which the resource was retrieved. |
read | [androidJvm] open suspend override fun read(range: LongRange?): ResourceTry<ByteArray> Reads the bytes at the given range. |
readAsBitmap | [androidJvm] open suspend fun readAsBitmap(): ResourceTry<Bitmap> Reads the full content as a Bitmap. |
readAsJson | [androidJvm] open suspend fun readAsJson(): ResourceTry<JSONObject> Reads the full content as a JSON object. |
readAsString | [androidJvm] open suspend fun readAsString(charset: Charset? = null): ResourceTry<String> Reads the full content as a String. |
readAsXml | [androidJvm] open suspend fun readAsXml(): ResourceTry<ElementNode> Reads the full content as an XML document. |
toString | [androidJvm] open override fun toString(): String |
Properties¶
Name | Summary |
---|---|
file | [androidJvm] open override val file: File? Direct file to this resource, when available. |
Inheritors¶
Name |
---|
TransformingResource |
BufferingResource |
Extensions¶
Name | Summary |
---|---|
buffered | [androidJvm] fun Resource.buffered(resourceLength: Long? = null, size: Long = BufferingResource.DEFAULT_BUFFER_SIZE): BufferingResource Wraps this resource in a BufferingResource to improve reading performances. |
cached | [androidJvm] fun Resource.~~cached~~(): Resource Creates a cached resource wrapping this resource. |
fallback | [androidJvm] fun Resource.fallback(fallbackResourceFactory: (Resource.Exception) -> Resource): Resource Falls back to alternative resources when the receiver fails. [androidJvm] fun Resource.fallback(fallbackResource: Resource): Resource Falls back to the given alternative resource when the receiver fails. |
synchronized | [androidJvm] fun Resource.synchronized(): SynchronizedResource Wraps this resource in a SynchronizedResource to protect the access from multiple threads. |