Skip to content

//readium-shared/org.readium.r2.shared.publication/Link

Link

[androidJvm]\ data class Link(val href: String, val type: String? = null, val templated: Boolean = false, val title: String? = null, val rels: Set<String> = setOf(), val properties: Properties = Properties(), val height: Int? = null, val width: Int? = null, val bitrate: Double? = null, val duration: Double? = null, val languages: List<String> = listOf(), val alternates: List<Link> = listOf(), val children: List<Link> = listOf()) : JSONable, Parcelable

Link Object for the Readium Web Publication Manifest. https://readium.org/webpub-manifest/schema/link.schema.json

Parameters

androidJvm

href URI or URI template of the linked resource.
type MIME type of the linked resource.
templated Indicates that a URI template is used in href.
title Title of the linked resource.
rels Relation between the linked resource and its containing collection.
properties Properties associated to the linked resource.
height Height of the linked resource in pixels.
width Width of the linked resource in pixels.
bitrate Bitrate of the linked resource in kbps.
duration Length of the linked resource in seconds.
languages Expected language of the linked resource (BCP 47 tag).
alternates Alternate resources for the linked resource.
children Resources that are children of the linked resource, in the context of a given collection role.

Constructors

Link [androidJvm]
fun Link(href: String, type: String? = null, templated: Boolean = false, title: String? = null, rels: Set<String> = setOf(), properties: Properties = Properties(), height: Int? = null, width: Int? = null, bitrate: Double? = null, duration: Double? = null, languages: List<String> = listOf(), alternates: List<Link> = listOf(), children: List<Link> = listOf())

Types

Name Summary
Companion [androidJvm]
object Companion

Functions

Name Summary
addProperties [androidJvm]
fun addProperties(properties: Map<String, Any>): Link
Makes a copy of this Link after merging in the given additional other properties.
describeContents [androidJvm]
abstract fun describeContents(): Int
expandTemplate [androidJvm]
fun expandTemplate(parameters: Map<String, String>): Link
Expands the HREF by replacing URI template variables by the given parameters.
toJSON [androidJvm]
open override fun toJSON(): JSONObject
Serializes a Link to its RWPM JSON representation.
toUrl [androidJvm]
fun toUrl(baseUrl: String?): String?
Computes an absolute URL to the link, relative to the given baseUrl.
writeToParcel [androidJvm]
abstract fun writeToParcel(p0: Parcel, p1: Int)

Properties

Name Summary
alternates [androidJvm]
val alternates: List<Link>
bitrate [androidJvm]
val bitrate: Double? = null
children [androidJvm]
val children: List<Link>
duration [androidJvm]
val duration: Double? = null
height [androidJvm]
val height: Int? = null
href [androidJvm]
val href: String
languages [androidJvm]
val languages: List<String>
mediaType [androidJvm]
val mediaType: MediaType
Media type of the linked resource.
properties [androidJvm]
val properties: Properties
rel [androidJvm]
val ~~rel~~: List<String>
rels [androidJvm]
val rels: Set<String>
templated [androidJvm]
val templated: Boolean = false
templateParameters [androidJvm]
val templateParameters: List<String>
List of URI template parameter keys, if the Link is templated.
title [androidJvm]
val title: String? = null
type [androidJvm]
val type: String? = null
typeLink [androidJvm]
val ~~typeLink~~: String?
width [androidJvm]
val width: Int? = null

Extensions

Name Summary
toLocator [androidJvm]
fun Link.~~toLocator~~(): Locator
Creates a Locator from a reading order Link.