import { ByteVector, StringType } from "../../byteVector"; import { IFileAbstraction } from "../../fileAbstraction"; import { Frame, FrameClassType } from "./frame"; import { Id3v2FrameHeader } from "./frameHeader"; import { IPicture, PictureType } from "../../picture"; export default class AttachmentFrame extends Frame implements IPicture { private _data; private _description; private _encoding; private _filename; private _mimeType; private _rawData; private _rawPicture; private _rawVersion; private _type; private constructor(); /** * Constructs and initializes a new attachment frame by populating it with the contents of a * section of a file. This constructor is only meant to be used internally. All loading is done * lazily. * @param file File to load frame data from * @param header ID3v2 frame header that defines the frame * @param frameStart Index into the file where the frame starts * @param size Length of the frame data * @param version ID3v2 version the frame was originally encoded with * @internal */ static fromFile(file: IFileAbstraction, header: Id3v2FrameHeader, frameStart: number, size: number, version: number): AttachmentFrame; /** * Constructs and initializes a new attachment frame by reading its raw data in a specified * ID3v2 version. * @param data ByteVector containing the raw representation of the new frame * @param offset Index into `data` where the frame actually begins * @param header Header of the frame found at `offset` in the data * @param version ID3v2 version the frame was originally encoded with */ static fromOffsetRawData(data: ByteVector, offset: number, header: Id3v2FrameHeader, version: number): AttachmentFrame; /** * Constructs and initializes a new attachment frame by populating it with the contents of * another {@link IPicture} object. * @remarks * When a frame is created, it is not automatically added to the tag. * Additionally, see {@link Tag.pictures} provides a generic way of getting and setting * attachments which is preferable to format specific code. * @param picture Value to use in the new instance. */ static fromPicture(picture: IPicture): AttachmentFrame; /** * Constructs and initializes a new attachment frame by reading its raw data in a specified * Id3v2 version. * @param data ByteVector starting with the raw representation of the new frame * @param version ID3v2 version the raw frame is encoded with. */ static fromRawData(data: ByteVector, version: number): AttachmentFrame; /** @inheritDoc */ get frameClassType(): FrameClassType; /** * Gets the image data stored in the current instance. */ get data(): ByteVector; /** * Sets the image data stored in the current instance. */ set data(value: ByteVector); /** * Gets the description stored in the current instance. */ get description(): string; /** * Sets the description stored in the current instance. * There should only be one frame with a matching description and type per tag. */ set description(value: string); /** * Gets a filename of the picture stored in the current instance. */ get filename(): string; /** * Sets a filename of the picture stored in the current instance. */ set filename(value: string); /** * Gets the MimeType of the picture stored in the current instance. */ get mimeType(): string; /** * Sets the MimeType of the picture stored in the current instance. * @param value MimeType of the picture stored in the current instance. */ set mimeType(value: string); /** * Gets the text encoding to use when storing the current instance. * @value Text encoding to use when storing the current instance. */ get textEncoding(): StringType; /** * Sets the text encoding to use when storing the current instance. * @param value Text encoding to use when storing the current instance. * This encoding is overridden when rendering if * {@link Id3v2Settings.forceDefaultEncoding} is `true` or the render version does not * support it. */ set textEncoding(value: StringType); /** * Gets the object type stored in the current instance. */ get type(): PictureType; /** * Sets the object type stored in the current instance. * For General Object Frame, use {@link PictureType.NotAPicture}. Other types will make it a * Picture Frame. */ set type(value: PictureType); /** @inheritDoc */ clone(): Frame; /** * Get a specified attachment frame from the specified tag, optionally creating it if it does * not exist. * @param frames List of attachment frames to search * @param description Description to match * @param type Picture type to match * @returns Matching frame or `undefined` if a match wasn't found and `create` is `false` */ static find(frames: AttachmentFrame[], description?: string, type?: PictureType): AttachmentFrame; /** * Generates a string representation of the current instance. * @deprecated No need for this. */ toString(): string; /** @inheritDoc */ protected parseFields(data: ByteVector, version: number): void; /** @inheritDoc */ protected renderFields(version: number): ByteVector; private parseFromRaw; private parseFromRawData; private parseFromRawPicture; }