C# Класс nl.siegmann.epublib.domain.Resource

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Resource ( System stream, string href ) : System

Creates a resource with the data from the given InputStream at the specified href. The MediaType will be determined based on the href extension.

Resource ( byte data, MediaType mediaType ) : System

Creates a Resource with the given data and MediaType. The href will be automatically generated. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8

Resource ( byte data, string href ) : System

Creates a resource with the given data at the specified href. The MediaType will be determined based on the href extension. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8

Resource ( string href ) : System

Creates an empty Resource with the given href. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8

Resource ( string id, byte data, string href, MediaType mediaType ) : System

Creates a resource with the given id, data, mediatype at the specified href. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8

Resource ( string id, byte data, string href, MediaType mediaType, string inputEncoding ) : System

Creates a resource with the given id, data, mediatype at the specified href. If the data is of a text type (html/css/etc) then it will use the given inputEncoding.

Resource ( string fileName, long size, string href ) : System

Creates a Lazy resource, by not actually loading the data for this entry. The data will be loaded on the first call to getData()

close ( ) : void

Tells this resource to release its cached data. If this resource was not lazy- loaded, this is a no-op.

equals ( Object resourceObject ) : bool

Checks to see of the given resourceObject is a resource and whether its href is equal to this one.

getData ( ) : byte[]

The contents of the resource as a byte[] If this resource was lazy-loaded and the data was not yet loaded, it will be loaded into memory at this point. This included opening the zip file, so expect a first load to be slow.

getHref ( ) : string

The location of the resource within the contents folder of the epub file. Example:
images/cover.jpg
content/chapter1.xhtml

getId ( ) : string

The resources Id. Must be both unique within all the resources of this book and a valid identifier.

getInputEncoding ( ) : string

The character encoding of the resource. Is allowed to be null for non-text resources like images.

getInputStream ( ) : Stream

Gets the contents of the Resource as an InputStream.

getMediaType ( ) : MediaType

This resource's mediaType.

getSize ( ) : long

Returns the size of this resource in bytes.

getTitle ( ) : string

If the title is found by scanning the underlying html document then it is cached here.

hashCode ( ) : int

Gets the hashCode of the Resource's href.

isInitialized ( ) : bool

Returns if the data for this resource has been loaded into memory.

setData ( byte data ) : void

Sets the data of the Resource. If the data is a of a different type then the original data then make sure to change the MediaType.

setHref ( string href ) : void

Sets the Resource's href.

setId ( string id ) : void

Sets the Resource's id: Make sure it is unique and a valid identifier.

setInputEncoding ( string encoding ) : void

Sets the Resource's input character encoding.

setMediaType ( MediaType mediaType ) : void
setTitle ( string title ) : void
toString ( ) : string

Описание методов

Resource() публичный Метод

Creates a resource with the data from the given InputStream at the specified href. The MediaType will be determined based on the href extension.
public Resource ( System stream, string href ) : System
stream System
href string The location of the resource within the epub. Example: /// "cover.jpg".
Результат System

Resource() публичный Метод

Creates a Resource with the given data and MediaType. The href will be automatically generated. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8
public Resource ( byte data, MediaType mediaType ) : System
data byte The Resource's contents
mediaType MediaType The MediaType of the Resource
Результат System

Resource() публичный Метод

Creates a resource with the given data at the specified href. The MediaType will be determined based on the href extension. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8
public Resource ( byte data, string href ) : System
data byte The Resource's contents
href string The location of the resource within the epub. Example: /// "chapter1.html".
Результат System

Resource() публичный Метод

Creates an empty Resource with the given href. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8
public Resource ( string href ) : System
href string The location of the resource within the epub. Example: /// "chapter1.html".
Результат System

Resource() публичный Метод

Creates a resource with the given id, data, mediatype at the specified href. Assumes that if the data is of a text type (html/css/etc) then the encoding will be UTF-8
public Resource ( string id, byte data, string href, MediaType mediaType ) : System
id string The id of the Resource. Internal use only. Will be auto- /// generated if it has a null-value.
data byte The Resource's contents
href string The location of the resource within the epub. Example: /// "chapter1.html".
mediaType MediaType The resources MediaType
Результат System

Resource() публичный Метод

Creates a resource with the given id, data, mediatype at the specified href. If the data is of a text type (html/css/etc) then it will use the given inputEncoding.
public Resource ( string id, byte data, string href, MediaType mediaType, string inputEncoding ) : System
id string The id of the Resource. Internal use only. Will be auto- /// generated if it has a null-value.
data byte The Resource's contents
href string The location of the resource within the epub. Example: /// "chapter1.html".
mediaType MediaType The resources MediaType
inputEncoding string If the data is of a text type (html/css/etc) then /// it will use the given inputEncoding.
Результат System

Resource() публичный Метод

Creates a Lazy resource, by not actually loading the data for this entry. The data will be loaded on the first call to getData()
public Resource ( string fileName, long size, string href ) : System
fileName string the fileName for the epub we're created from.
size long the size of this resource.
href string The resource's href within the epub.
Результат System

close() публичный Метод

Tells this resource to release its cached data. If this resource was not lazy- loaded, this is a no-op.
public close ( ) : void
Результат void

equals() публичный Метод

Checks to see of the given resourceObject is a resource and whether its href is equal to this one.
public equals ( Object resourceObject ) : bool
resourceObject Object
Результат bool

getData() публичный Метод

The contents of the resource as a byte[] If this resource was lazy-loaded and the data was not yet loaded, it will be loaded into memory at this point. This included opening the zip file, so expect a first load to be slow.
public getData ( ) : byte[]
Результат byte[]

getHref() публичный Метод

The location of the resource within the contents folder of the epub file. Example:
images/cover.jpg
content/chapter1.xhtml
public getHref ( ) : string
Результат string

getId() публичный Метод

The resources Id. Must be both unique within all the resources of this book and a valid identifier.
public getId ( ) : string
Результат string

getInputEncoding() публичный Метод

The character encoding of the resource. Is allowed to be null for non-text resources like images.
public getInputEncoding ( ) : string
Результат string

getInputStream() публичный Метод

Gets the contents of the Resource as an InputStream.
public getInputStream ( ) : Stream
Результат System.IO.Stream

getMediaType() публичный Метод

This resource's mediaType.
public getMediaType ( ) : MediaType
Результат MediaType

getSize() публичный Метод

Returns the size of this resource in bytes.
public getSize ( ) : long
Результат long

getTitle() публичный Метод

If the title is found by scanning the underlying html document then it is cached here.
public getTitle ( ) : string
Результат string

hashCode() публичный Метод

Gets the hashCode of the Resource's href.
public hashCode ( ) : int
Результат int

isInitialized() публичный Метод

Returns if the data for this resource has been loaded into memory.
public isInitialized ( ) : bool
Результат bool

setData() публичный Метод

Sets the data of the Resource. If the data is a of a different type then the original data then make sure to change the MediaType.
public setData ( byte data ) : void
data byte data
Результат void

setHref() публичный Метод

Sets the Resource's href.
public setHref ( string href ) : void
href string href
Результат void

setId() публичный Метод

Sets the Resource's id: Make sure it is unique and a valid identifier.
public setId ( string id ) : void
id string id
Результат void

setInputEncoding() публичный Метод

Sets the Resource's input character encoding.
public setInputEncoding ( string encoding ) : void
encoding string encoding
Результат void

setMediaType() публичный Метод

public setMediaType ( MediaType mediaType ) : void
mediaType MediaType
Результат void

setTitle() публичный Метод

public setTitle ( string title ) : void
title string
Результат void

toString() публичный Метод

public toString ( ) : string
Результат string