ddn.odf.container.reader
Packaged ODF ZIP reader.
Opens ODF ZIP packages through ddn.archive.zip, reads the mimetype entry for document-family detection, and provides lazy access to package entries and standard streams.
class OdfPackageReader
Types 1
classOdfPackageReader
Reads an ODF ZIP package from a file path or in-memory buffer.
The reader opens the ZIP archive, iterates all entries, and reads the mimetype entry immediately for document-family detection. Other entry contents are loaded on demand through loadEntryContent.
Callers should call close() when done, or use the RAII pattern by assigning to a scope variable.
Fields
private ArchiveReader _archiveprivate OdfPackageEntry[] _entriesprivate size_t[string] _entryIndexprivate string _mimeTypeprivate OdfDocumentType _docTypeprivate OdfReadOptions _optionsprivate bool _closedMethods
OdfPackageReader open(string path,
OdfReadOptions options = OdfReadOptions.init)Opens an ODF package from a file path.OdfPackageReader openFromMemory(const(ubyte)[] data,
OdfReadOptions options = OdfReadOptions.init)Opens an ODF package from an in-memory buffer.string mimeType() @property const @safe pure nothrow @nogcReturns the MIME type detected from the package `mimetype` entry.OdfDocumentType documentType() @property const @safe pure nothrow @nogcReturns the document type detected from the package MIME data.const(OdfPackageEntry)[] entries() @property const @safe pure nothrow @nogcReturns all package entries with their metadata.size_t entryCount() @property const @safe pure nothrow @nogcReturns the number of entries in the package.bool isClosed() @property const @safe pure nothrow @nogcReturns `true` if the package has been closed.bool contains(string path) const @safe pure nothrow @nogcChecks whether the package contains an entry with the given path.const(OdfPackageEntry) * getEntry(string path) const @safe pure nothrowReturns a pointer to the entry with the given path, or `null` if not found.ubyte[] loadEntryContent(string path)Loads the content of the entry with the given path.ubyte[] contentXml()Convenience method to load `content.xml`.ubyte[] stylesXml()Convenience method to load `styles.xml`.ubyte[] metaXml()Convenience method to load `meta.xml`.ubyte[] settingsXml()Convenience method to load `settings.xml`.ubyte[] manifestXml()Convenience method to load `META-INF/manifest.xml`.ManifestModel manifestModel()Parses and returns the manifest model from `META-INF/manifest.xml`.OdfAssetIndex assetIndex()Builds an asset index from the package entries and manifest.void close()Closes the underlying ZIP archive and releases resources.void _indexEntries()void _readMimetype()ubyte[] loadStandardEntry(string path)Constructors
this(ArchiveReader archive, OdfReadOptions options)Destructors