Show / Hide Table of Contents

Class EpubLocalContentFileRef

The base class for a content file reference within the EPUB archive (e.g., an HTML file or an image). Unlike EpubLocalContentFile, the classes derived from this base class contain only a reference to the file but don't contain its content.

Inheritance
object
EpubContentFileRef
EpubLocalContentFileRef
EpubLocalByteContentFileRef
EpubLocalTextContentFileRef
Inherited Members
EpubContentFileRef.Key
EpubContentFileRef.ContentType
EpubContentFileRef.ContentMimeType
EpubContentFileRef.ContentFileType
EpubContentFileRef.Metadata
EpubContentFileRef.EpubContentLoader
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VersOne.Epub
Assembly: VersOne.Epub.dll
Syntax
public abstract class EpubLocalContentFileRef : EpubContentFileRef

Constructors

View Source

EpubLocalContentFileRef(EpubContentFileRefMetadata, string, IEpubContentLoader)

Initializes a new instance of the EpubLocalContentFileRef class with a specified content file key, a content type of the file reference, a MIME type of the file's content, a EPUB file reference, a content directory path, and an optional content reader options.

Declaration
protected EpubLocalContentFileRef(EpubContentFileRefMetadata metadata, string filePath, IEpubContentLoader epubContentLoader)
Parameters
Type Name Description
EpubContentFileRefMetadata metadata

Metadata of this content file reference.

string filePath

The absolute path of the local content file in the EPUB archive.

IEpubContentLoader epubContentLoader

A reference to the EPUB content loader which provides methods to load the content of this file.

Exceptions
Type Condition
ArgumentNullException

The metadata parameter is null.

ArgumentNullException

The filePath parameter is null.

ArgumentNullException

The epubContentLoader parameter is null.

Properties

View Source

ContentLocation

Gets the location of the content file which is always LOCAL for local content file references.

Declaration
public override EpubContentLocation ContentLocation { get; }
Property type: EpubContentLocation
Overrides
EpubContentFileRef.ContentLocation
View Source

FilePath

Gets the absolute path of the local content file in the EPUB archive.

Declaration
public string FilePath { get; }
Property type: string

Methods

View Source

GetContentStream()

Opens the referenced file and returns a Stream to access its content.

Declaration
public Stream GetContentStream()
Returns
Type Description
Stream

A Stream to access the referenced file's content.

View Source

GetContentStreamAsync()

Opens the referenced file and returns a Stream to access its content.

Declaration
public Task<Stream> GetContentStreamAsync()
Returns
Type Description
Task<Stream>

A task that represents the asynchronous open operation. The value of the TResult parameter contains the Stream to access the referenced file's content.

View Source

ReadContentAsBytes()

Reads the whole content of the referenced file and returns it as a byte array.

Declaration
public byte[] ReadContentAsBytes()
Returns
Type Description
byte[]

Content of the referenced file.

View Source

ReadContentAsBytesAsync()

Asynchronously reads the whole content of the referenced file and returns it as a byte array.

Declaration
public Task<byte[]> ReadContentAsBytesAsync()
Returns
Type Description
Task<byte[]>

A task that represents the asynchronous read operation. The value of the TResult parameter contains the content of the referenced file.

View Source

ReadContentAsText()

Reads the whole content of the referenced file and returns it as a string.

Declaration
public string ReadContentAsText()
Returns
Type Description
string

Content of the referenced file.

View Source

ReadContentAsTextAsync()

Asynchronously reads the whole content of the referenced file and returns it as a string.

Declaration
public Task<string> ReadContentAsTextAsync()
Returns
Type Description
Task<string>

A task that represents the asynchronous read operation. The value of the TResult parameter contains the content of the referenced file.

  • View Source
In this article
Back to top Generated by DocFX