import BaseObject from "./baseObject"; import HeaderExtensionObject from "./headerExtensionObject"; import { ByteVector } from "../../byteVector"; import { ObjectType } from "../constants"; import { File } from "../../file"; import { Properties } from "../../properties"; /** * This class provides a representation of an ASF header object which can be read from and written * to disk. */ export default class HeaderObject extends BaseObject { private readonly _children; private _properties; private _reserved; private constructor(); /** * Constructs and initializes a new instance by reading the contents from a specified position * in the provided file. * @param file File containing contents that will be read into the new instance * @param position Position in the file where the instance begins */ static fromFile(file: File, position: number): HeaderObject; /** * Gets that child objects of this instance. * @remarks * The returned array is a copy of the array of children inside this object. Any * changes to this array will not be reflected in the object. * * Only certain objects are valid inside a header object. Any objects that are not valid or * not supported are read as {@link UnknownObject}. */ get children(): BaseObject[]; /** * Gets the header extension object contained in the current instance. * @returns * Header extension contained in this instance, if it exists. * `undefined` is returned if it doesn't exist */ get extension(): HeaderExtensionObject; /** * Gets whether the current instance contains either type of content descriptors. * @returns * `true` if a content description object or extended content description * object exists in this instance. `false` otherwise */ get hasContentDescriptors(): boolean; /** @inheritDoc */ get objectType(): ObjectType; /** * Get the media properties contained within the current instance. */ get properties(): Properties; /** * Adds a unique child object to the current instance, replacing an existing child if present. * @param obj Object to add to the current instance */ addUniqueObject(obj: BaseObject): void; /** * Removes the content description objects from the current instance. */ removeContentDescriptor(): void; /** @inheritDoc */ render(): ByteVector; /** * Reads a single object from the current instance. * @remarks * If the object read is invalid to be under the top level header object, the object * will be read in as an {@link UnknownObject}. * @param file File to read the objects from * @param position Position within the file at which the object begins * @returns An object of the appropriate type as read from the current instance */ private static readObject; /** * Reads a collection of objects from the current instance. * @param file File to read objects from * @param count Number of objects to read, must be a positive, 32-bit integer * @param position Position within the file at which to start reading objects * @returns BaseObject[] Array of objects read from the file */ private static readObjects; }