import UuidWrapper from "../../uuidWrapper"; import { ByteVector } from "../../byteVector"; import { ObjectType } from "../constants"; import { File } from "../../file"; /** * Base object that provides a basic representation of an ASF object that can be written to and * read from the disk. */ export default abstract class BaseObject { private _id; private _originalSize; protected constructor(); /** * Initializes a new instance by reading the contents from a specified position in a specified * file. * @param file File which contains the details of the new instance to create * @param position Position in `file` where the object begins * @protected */ protected initializeFromFile(file: File, position: number): void; /** * Initializes a new instance with a specified GUID. * @param guid GUID to use for the new instance. * @protected */ protected initializeFromGuid(guid: UuidWrapper): void; /** * Gets the GUID that identifies the current instance. */ get guid(): UuidWrapper; /** * Gets the type of the object for easy comparison. */ abstract get objectType(): ObjectType; /** * Gets the original size of the current instance. */ get originalSize(): number; /** * Renders the current instance as a raw ASF object. */ abstract render(): ByteVector; /** * Renders the current instance as a raw ASF object containing the specified data. * @remarks * Child classes implementing {@link render()} should render their contents and then * send the data through this method to produce the final output. * @param data Data to store in the rendered version of the current instance. */ protected renderInternal(data: ByteVector): ByteVector; }