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
Inherited Members
Namespace: VersOne.Epub
Assembly: VersOne.Epub.dll
Syntax
public abstract class EpubLocalContentFileRef : EpubContentFileRef
Constructors
View SourceEpubLocalContentFileRef(EpubContentFileRefMetadata, string, IZipFileEntry?, 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, IZipFileEntry? contentFileEntry, 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. |
| IZipFileEntry | contentFileEntry | The reference to the underlying 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 |
| ArgumentNullException | The |
| ArgumentNullException | The |
Properties
View SourceContentFileEntry
Gets the reference to the underlying local content file in the EPUB archive or null if the file is not present in the EPUB archive.
Declaration
public IZipFileEntry? ContentFileEntry { get; }
Property type: IZipFileEntry
View SourceContentLocation
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
View SourceFilePath
Gets the absolute path of the local content file in the EPUB archive.
Declaration
public string FilePath { get; }
Property type: string
Methods
View SourceGetContentStream()
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. |
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. |
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. |
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. |
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. |
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. |