import IRiffChunk from "./iRiffChunk"; import { ByteVector } from "../byteVector"; import { File } from "../file"; import { ILazy } from "../interfaces"; /** * Represents a block of data in a RIFF file. Used primarily for reading and writing files. */ export default class RiffChunk implements IRiffChunk, ILazy { private _chunkStart; private _data; private _file; private _fourcc; private _originalDataSize; private constructor(); /** * Creates and initializes a new instance, lazily, from a position of a file. * @param file File from which to read the current instance * @param fourcc FOURCC code for the chunk * @param position Position in the file where the chunk begins */ static fromFile(file: File, fourcc: string, position: number): RiffChunk; /** * Creates and initializes a new instance from the provided data. * @param fourcc FOURCC code for the chunk * @param data Data to contain in the chunk, not includeing FOURCC or size */ static fromData(fourcc: string, data: ByteVector): RiffChunk; /** @inheritDoc */ get chunkStart(): number | undefined; /** @internal */ set chunkStart(value: number); /** * Data contained in the chunk. */ get data(): ByteVector; /** @inheritDoc */ get fourcc(): string; /** @inheritDoc */ get isLoaded(): boolean; /** @inheritDoc */ get originalDataSize(): number; /** @inheritDoc */ get originalTotalSize(): number; /** @internal */ set originalTotalSize(value: number); /** @inheritDoc */ load(): void; /** @inheritDoc */ render(): ByteVector; }