C# Class nl.siegmann.epublib.domain.Resource

Afficher le fichier Open project: lanfengqi/EpubLib-Sharp Class Usage Examples

Méthodes publiques

Méthode Description
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

Method Details

Resource() public méthode

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".
Résultat System

Resource() public méthode

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
Résultat System

Resource() public méthode

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".
Résultat System

Resource() public méthode

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".
Résultat System

Resource() public méthode

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
Résultat System

Resource() public méthode

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.
Résultat System

Resource() public méthode

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.
Résultat System

close() public méthode

Tells this resource to release its cached data. If this resource was not lazy- loaded, this is a no-op.
public close ( ) : void
Résultat void

equals() public méthode

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
Résultat bool

getData() public méthode

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[]
Résultat byte[]

getHref() public méthode

The location of the resource within the contents folder of the epub file. Example:
images/cover.jpg
content/chapter1.xhtml
public getHref ( ) : string
Résultat string

getId() public méthode

The resources Id. Must be both unique within all the resources of this book and a valid identifier.
public getId ( ) : string
Résultat string

getInputEncoding() public méthode

The character encoding of the resource. Is allowed to be null for non-text resources like images.
public getInputEncoding ( ) : string
Résultat string

getInputStream() public méthode

Gets the contents of the Resource as an InputStream.
public getInputStream ( ) : Stream
Résultat System.IO.Stream

getMediaType() public méthode

This resource's mediaType.
public getMediaType ( ) : MediaType
Résultat MediaType

getSize() public méthode

Returns the size of this resource in bytes.
public getSize ( ) : long
Résultat long

getTitle() public méthode

If the title is found by scanning the underlying html document then it is cached here.
public getTitle ( ) : string
Résultat string

hashCode() public méthode

Gets the hashCode of the Resource's href.
public hashCode ( ) : int
Résultat int

isInitialized() public méthode

Returns if the data for this resource has been loaded into memory.
public isInitialized ( ) : bool
Résultat bool

setData() public méthode

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
Résultat void

setHref() public méthode

Sets the Resource's href.
public setHref ( string href ) : void
href string href
Résultat void

setId() public méthode

Sets the Resource's id: Make sure it is unique and a valid identifier.
public setId ( string id ) : void
id string id
Résultat void

setInputEncoding() public méthode

Sets the Resource's input character encoding.
public setInputEncoding ( string encoding ) : void
encoding string encoding
Résultat void

setMediaType() public méthode

public setMediaType ( MediaType mediaType ) : void
mediaType MediaType
Résultat void

setTitle() public méthode

public setTitle ( string title ) : void
title string
Résultat void

toString() public méthode

public toString ( ) : string
Résultat string