using System;
using System.Threading.Tasks;
namespace VersOne.Epub
{
///
/// A reference for a file within the EPUB archive which allows to read its content as a byte array.
/// Unlike , this class contains only a reference to the file but doesn't contain its content.
///
public class EpubLocalByteContentFileRef : EpubLocalContentFileRef
{
///
/// Initializes a new instance of the class with a specified EPUB book reference, a file name, a content type of the file,
/// and a MIME type of the file's content.
///
/// Metadata of this content file reference.
/// The absolute path of the local content file in the EPUB archive.
/// A reference to the EPUB content loader which provides methods to load the content of this file.
/// The parameter is null.
/// The parameter is null.
/// The parameter is null.
public EpubLocalByteContentFileRef(EpubContentFileRefMetadata metadata, string filePath, IEpubContentLoader epubContentLoader)
: base(metadata, filePath, epubContentLoader)
{
}
///
/// Gets the type of the content file which is always for local byte content file references.
///
public override EpubContentFileType ContentFileType => EpubContentFileType.BYTE_ARRAY;
///
/// Reads the whole content of the referenced file and returns it as a byte array.
///
/// Content of the referenced file.
public byte[] ReadContent()
{
return ReadContentAsBytes();
}
///
/// Asynchronously reads the whole content of the referenced file and returns it as a byte array.
///
/// A task that represents the asynchronous read operation. The value of the TResult parameter contains the content of the referenced file.
public Task ReadContentAsync()
{
return ReadContentAsBytesAsync();
}
}
}