Resource

open class Resource(var id: String?, var data: ByteArray?, var href: String?, var mediaType: MediaType?, var inputEncoding: String = Constants.CHARACTER_ENCODING)(source)

Represents a resource that is part of the epub. A resource can be a html file, image, xml, etc.

Inheritors

Constructors

Link copied to clipboard
constructor(id: String?, data: ByteArray?, href: String?, mediaType: MediaType?, inputEncoding: String = Constants.CHARACTER_ENCODING)
constructor(href: String)
constructor(data: ByteArray, mediaType: MediaType?)
constructor(data: ByteArray, href: String)
constructor(id: String, data: ByteArray, href: String)

Properties

Link copied to clipboard
open var data: ByteArray?
Link copied to clipboard
var href: String?
Link copied to clipboard
var id: String?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val size: Long

Functions

Link copied to clipboard

Returns the resource's bytes decoded as a String using the resource's inputEncoding.

Link copied to clipboard
open fun bytes(): ByteArray

Returns the resource's bytes (loading them if lazy).

Link copied to clipboard
open fun close()

Tells this resource to release its cached data.

Link copied to clipboard
open fun source(): Source

Gets the contents of the Resource as an okio Source.