import { IAsset } from '../library/IAsset'; import { URLRequest } from '../net/URLRequest'; import { EventDispatcher } from '../events/EventDispatcher'; import { ResourceDependency } from '../parsers/ResourceDependency'; import { ByteArray } from '../utils/ByteArray'; /** * ParserBase provides an abstract base export class for objects * that convert blocks of data to data structures supported by away. * * If used by Loader to automatically determine the parser type, * two public static methods should be implemented, with the following * signatures: * * public static supportsType(extension : string) : boolean * Indicates whether or not a given file extension is supported by the parser. * * public static supportsData(data : *) : boolean Tests whether a * data block can be parsed by the parser. * * Furthermore, for any concrete subtype, the method initHandle * should be overridden to immediately create the object that will contain the * parsed data. This allows ResourceManager to return an object * handle regardless of whether the object was loaded or not. * * @see Loader */ export declare class ParserBase extends EventDispatcher { private _isParsing; private _dataFormat; private _data; private _frameLimit; private _onIntervalDelegate; private static _lastFrameTime; protected _content: IAsset; fileName: string; materialMode: number; static supportsType(extension: string): boolean; private _dependencies; private _parsingPaused; private _parsingComplete; private _parsingFailure; private _timer; get content(): IAsset; /** * Creates a new ParserBase object * @param format The data format of the file data to be parsed. Can be * either ParserDataFormat.BINARY or * ParserDataFormat.PLAIN_TEXT, and should be provided by the * concrete subtype. * * @see away.loading.parsers.ParserDataFormat */ constructor(format: string); set parsingFailure(b: boolean); get parsingFailure(): boolean; get parsingPaused(): boolean; get parsingComplete(): boolean; get data(): any; /** * The data format of the file data to be parsed. Options are * URLLoaderDataFormat.BINARY, * URLLoaderDataFormat.ARRAY_BUFFER, * URLLoaderDataFormat.BLOB, * URLLoaderDataFormat.VARIABLES or * URLLoaderDataFormat.TEXT. */ get dataFormat(): string; /** * Parse data (possibly containing bytearry, plain text or BitmapAsset) * asynchronously, meaning that the parser will periodically stop parsing so * that the AVM may proceed to the next frame. * * @param data The untyped data object in which the loaded data resides. * @param frameLimit number of milliseconds of parsing allowed per frame. * The actual time spent on a frame can exceed this number since time-checks * can only be performed between logical sections of the parsing procedure. */ parseAsync(data: any, frameLimit?: number): void; /** * A list of dependencies that need to be loaded and resolved for the object * being parsed. */ get dependencies(): Array; /** * Resolve a dependency when it's loaded. For example, a dependency * containing an ImageResource would be assigned to a Mesh instance as a * BitmapMaterial, a scene graph object would be added to its intended * parent. The dependency should be a member of the dependencies property. * * @param resourceDependency The dependency to be resolved. */ resolveDependency(resourceDependency: ResourceDependency): void; /** * Resolve a dependency loading failure. Used by parser to eventually * provide a default map * * @param resourceDependency The dependency to be resolved. */ resolveDependencyFailure(resourceDependency: ResourceDependency): void; /** * Resolve a dependency name * * @param resourceDependency The dependency to be resolved. */ resolveDependencyName(resourceDependency: ResourceDependency, asset: IAsset): string; resumeParsing(): void; protected finalizeAsset(asset: IAsset, name?: string): void; /** * Parse the next block of data. * @return Whether or not more data needs to be parsed. Can be * ParserBase.ParserBase.PARSING_DONE or * ParserBase.ParserBase.MORE_TO_PARSE. */ protected proceedParsing(): void; protected dieWithError(message?: string): void; protected addDependency(id: string, req: URLRequest, parser?: ParserBase, data?: any, retrieveAsRawData?: boolean, suppressErrorEvents?: boolean, sub_id?: number): ResourceDependency; protected pauseAndRetrieveDependencies(): void; /** * Tests whether or not there is still time left for parsing within the * maximum allowed time frame per session. * @return True if there is still time left, false if the maximum allotted * time was exceeded and parsing should be interrupted. */ protected hasTime(): boolean; /** * Called when the parsing pause interval has passed and parsing can * proceed. */ private _onInterval; /**# * Initializes the parsing of data. * @param frameLimit The maximum duration of a parsing session. */ protected startParsing(frameLimit: number): void; /** * Finish parsing the data. */ protected finishParsing(): void; /** * * @returns {string} * @private */ protected getTextData(): string; /** * * @returns {ByteArray} * @private */ protected getByteData(): ByteArray; /** * * @returns {any} * @private */ protected getData(): any; } //# sourceMappingURL=ParserBase.d.ts.map