/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { RawFileDescriptor as _RawFileDescriptor } from './global/rawFileDescriptor'; import { Resource as _Resource } from './global/resource'; import { AsyncCallback as _AsyncCallback } from './@ohos.base'; import { DrawableDescriptor } from './@ohos.arkui.drawableDescriptor'; /** * Provides resource related APIs. * * @namespace resourceManager * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Provides resource related APIs. * * @namespace resourceManager * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ declare namespace resourceManager { /** * Enumerates screen directions. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Enumerates screen directions. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export enum Direction { /** * Indicates the vertical direction. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the vertical direction. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ DIRECTION_VERTICAL = 0, /** * Indicates the horizontal direction. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the horizontal direction. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ DIRECTION_HORIZONTAL = 1 } /** * Enumerates device types. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Enumerates device types. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export enum DeviceType { /** * Indicates a phone. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a phone. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ DEVICE_TYPE_PHONE = 0x00, /** * Indicates a tablet. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a tablet. * * @syscap SystemCapability.Global.ResourceManager * @since 10 */ DEVICE_TYPE_TABLET = 0x01, /** * Indicates a car. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a car. * * @syscap SystemCapability.Global.ResourceManager * @since 10 */ DEVICE_TYPE_CAR = 0x02, /** * Indicates a PC. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a PC. * * @syscap SystemCapability.Global.ResourceManager * @since 10 */ DEVICE_TYPE_PC = 0x03, /** * Indicates a smart TV. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a smart TV. * * @syscap SystemCapability.Global.ResourceManager * @since 10 */ DEVICE_TYPE_TV = 0x04, /** * Indicates a wearable device. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates a wearable device. * * @syscap SystemCapability.Global.ResourceManager * @since 10 */ DEVICE_TYPE_WEARABLE = 0x06 } /** * Enumerates screen density types. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Enumerates screen density types. * * @enum { number } * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export enum ScreenDensity { /** * Indicates small screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates small screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_SDPI = 120, /** * Indicates medium screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates medium screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_MDPI = 160, /** * Indicates large screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates large screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_LDPI = 240, /** * Indicates extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_XLDPI = 320, /** * Indicates extra-extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates extra-extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_XXLDPI = 480, /** * Indicates extra-extra-extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates extra-extra-extra-large screen density. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ SCREEN_XXXLDPI = 640 } /** * Provides the device configuration. * * @since 6 */ /** * Provides the device configuration. * * @crossplatform * @since 10 */ export class Configuration { /** * Indicates the screen direction of the current device. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the screen direction of the current device. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ direction: Direction; /** * Indicates the current system language, for example, zh-Hans-CN. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the current system language, for example, zh-Hans-CN. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ locale: string; } /** * Provides the device capability. * * @since 6 */ /** * Provides the device capability. * * @crossplatform * @since 10 */ export class DeviceCapability { /** * Indicates the screen density of the current device. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the screen density of the current device. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ screenDensity: ScreenDensity; /** * Indicates the type of the current device. * * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Indicates the type of the current device. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ deviceType: DeviceType; } /** * The ResourceManager callback. * * @interface AsyncCallback * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 */ export interface AsyncCallback { (err: Error, data: T): void; } /** * Obtains the ResourceManager object of the current application. * * @param { AsyncCallback } callback - Indicates the callback containing the ResourceManager object. * @syscap SystemCapability.Global.ResourceManager * @FAModelOnly * @since 6 */ export function getResourceManager(callback: AsyncCallback): void; /** * Obtains the ResourceManager object of the specified application. * * @param { string } bundleName - Indicates the bundle name of the specified application. * @param { AsyncCallback } callback - Indicates the callback containing the ResourceManager object. * @syscap SystemCapability.Global.ResourceManager * @FAModelOnly * @since 6 */ export function getResourceManager(bundleName: string, callback: AsyncCallback): void; /** * Obtains the ResourceManager object of the current application. * * @returns { Promise } The ResourceManager object is returned in Promise mode. * @syscap SystemCapability.Global.ResourceManager * @FAModelOnly * @since 6 */ export function getResourceManager(): Promise; /** * Obtains the ResourceManager object of the specified application. * * @param { string } bundleName - Indicates the bundle name of the specified application. * @returns { Promise } The ResourceManager object is returned in Promise mode. * @syscap SystemCapability.Global.ResourceManager * @FAModelOnly * @since 6 */ export function getResourceManager(bundleName: string): Promise; /** * Obtains a global shared system ResourceManager object that provides access to only system resource, in which the * resConfig is default value(contains resLocale, screenDensityDpi, direction, etc). * * @returns { ResourceManager } The System ResourceManager object is returned. * @throws { BusinessError } 9001009 - If application can't access system resource * which is not mapped to application sandbox, This error code will be thrown. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ export function getSystemResourceManager(): ResourceManager; /** * Provides the capability of accessing application resources. * * @interface ResourceManager * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Provides the capability of accessing application resources. * * @interface ResourceManager * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export interface ResourceManager { /** * Obtains the character string corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringValue */ getString(resId: number, callback: AsyncCallback): void; /** * Obtains string resources associated with a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The character string corresponding to the resource ID. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringValue */ getString(resId: number): Promise; /** * Obtains the character string corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the character string corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringValue(resource: Resource, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains string resources associated with a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringValue(resource: Resource): Promise; /** * Obtains the array of character strings corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringArrayValue */ getStringArray(resId: number, callback: AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise> } The array of character strings corresponding to the specified resource ID. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringArrayValue */ getStringArray(resId: number): Promise>; /** * Obtains the array of character strings corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringArrayValue(resource: Resource, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise> } The array of character strings corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise> } The array of character strings corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringArrayValue(resource: Resource): Promise>; /** * Obtains the content of the media file corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContent */ getMedia(resId: number, callback: AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The content of the media file corresponding to the specified resource ID. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContent */ getMedia(resId: number): Promise; /** * Obtains the content of the media file corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getMediaContent(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the content of the specified screen density media file corresponding to a specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained * specified screen density media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContent(resource: Resource, density: number, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The content of the media file corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The content of the media file corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getMediaContent(resource: Resource): Promise; /** * Obtains the content of the specified screen density media file corresponding to a specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } The content of the specified screen density media file corresponding to the * specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContent(resource: Resource, density: number): Promise; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContentBase64 */ getMediaBase64(resId: number, callback: AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The Base64 code of the image resource corresponding to the specified resource ID. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContentBase64 */ getMediaBase64(resId: number): Promise; /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getMediaContentBase64(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the * specified screen density image resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContentBase64(resource: Resource, density: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The Base64 code of the image resource corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } The Base64 code of the image resource corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getMediaContentBase64(resource: Resource): Promise; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource object in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } The Base64 code of the specified screen density image resource corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContentBase64(resource: Resource, density: number): Promise; /** * Obtains the device capability in callback mode. * * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained device capability. * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Obtains the device capability in callback mode. * * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained device capability. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getDeviceCapability(callback: _AsyncCallback): void; /** * Obtains the device capability in Promise mode. * * @returns { Promise } the device capability. * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Obtains the device capability in Promise mode. * * @returns { Promise } the device capability. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getDeviceCapability(): Promise; /** * Obtains the device configuration in callback mode. * * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained device * configuration. * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Obtains the device configuration in callback mode. * * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained device * configuration. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getConfiguration(callback: _AsyncCallback): void; /** * Obtains the device configuration in Promise mode. * * @returns { Promise } the device configuration. * @syscap SystemCapability.Global.ResourceManager * @since 6 */ /** * Obtains the device configuration in Promise mode. * * @returns { Promise } the device configuration. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getConfiguration(): Promise; /** * Obtains the singular-plural character string represented by the ID string corresponding to the * specified number in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the ID string corresponding to the specified number. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getPluralStringValue */ getPluralString(resId: number, num: number, callback: AsyncCallback): void; /** * Obtains the singular-plural character string represented by the ID string corresponding to * the specified number in Promise mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @returns { Promise } The singular-plural character string represented by the ID string * corresponding to the specified number. * @syscap SystemCapability.Global.ResourceManager * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getPluralStringValue */ getPluralString(resId: number, num: number): Promise; /** * Obtains the singular-plural character string represented by the resource object string corresponding to the * specified number in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the resource object string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the singular-plural character string represented by the resource object string corresponding to the * specified number in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the resource object string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the resource object string corresponding to * the specified number in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } num - Indicates the number. * @returns { Promise } The singular-plural character string represented by the resource object string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the singular-plural character string represented by the resource object string corresponding to * the specified number in Promise mode. * * @param { Resource } resource - Indicates the resource object. * @param { number } num - Indicates the number. * @returns { Promise } The singular-plural character string represented by the resource object string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getPluralStringValue(resource: Resource, num: number): Promise; /** * Obtains the raw file resource corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFileContent */ getRawFile(path: string, callback: AsyncCallback): void; /** * Obtains the raw file resource corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The raw file resource corresponding to the specified resource path. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFileContent */ getRawFile(path: string): Promise; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource descriptor. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFd */ getRawFileDescriptor(path: string, callback: AsyncCallback): void; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The raw file resource descriptor corresponding to the specified resource path. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFd */ getRawFileDescriptor(path: string): Promise; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { AsyncCallback } callback - Indicates the asynchronous callback used to return result close raw file resource descriptor. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.closeRawFd */ closeRawFileDescriptor(path: string, callback: AsyncCallback): void; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The result close raw file resource descriptor corresponding to the specified resource path. * @syscap SystemCapability.Global.ResourceManager * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.closeRawFd */ closeRawFileDescriptor(path: string): Promise; /** * Obtains the character string corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the character string corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringByName(resName: string, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains string resources associated with a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringByName(resName: string): Promise; /** * Obtains the array of character strings corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringArrayByName(resName: string, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise> } the array of character strings corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise> } the array of character strings corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringArrayByName(resName: string): Promise>; /** * Obtains the content of the media file corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the content of the specified screen density media file corresponding to a specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained * specified screen density media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaByName(resName: string, density: number, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The content of the media file corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The content of the media file corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaByName(resName: string): Promise; /** * Obtains the content of the specified screen density media file corresponding to a specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } The content of the specified screen density media file corresponding to the * specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaByName(resName: string, density: number): Promise; /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaBase64ByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource name in callback mode. * * @param { string } resName - Indicates the resource name. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the * specified screen density image resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaBase64ByName(resName: string, density: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The Base64 code of the image resource corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } The Base64 code of the image resource corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaBase64ByName(resName: string): Promise; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource name in Promise mode. * * @param { string } resName - Indicates the resource name. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } The Base64 code of the specified screen density image resource corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaBase64ByName(resName: string, density: number): Promise; /** * Obtains the singular-plural character string represented by the name string corresponding to the * specified number in callback mode. * * @param { string } resName - Indicates the resource name. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the name string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the singular-plural character string represented by the name string corresponding to the * specified number in callback mode. * * @param { string } resName - Indicates the resource name. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the name string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getPluralStringByName(resName: string, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the name string corresponding to * the specified number in Promise mode. * * @param { string } resName - Indicates the resource name. * @param { number } num - Indicates the number. * @returns { Promise } the singular-plural character string represented by the name string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the singular-plural character string represented by the name string corresponding to * the specified number in Promise mode. * * @param { string } resName - Indicates the resource name. * @param { number } num - Indicates the number. * @returns { Promise } the singular-plural character string represented by the name string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getPluralStringByName(resName: string, num: number): Promise; /** * Obtains string resources associated with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { string } The character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains string resources associated with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { string } The character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringSync(resId: number): string; /** * Obtains string resources associated with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @param { Array } args - Indicates the formatting string resource parameters. * @returns { string } The character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @throws { BusinessError } 9001007 - If the resource obtained by resId formatting error. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringSync(resId: number, ...args: Array): string; /** * Obtains string resources associated with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { string } The character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains string resources associated with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { string } The character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringSync(resource: Resource): string; /** * Obtains string resources associated with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @param { Array } args - Indicates the formatting string resource parameters. * @returns { string } The character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @throws { BusinessError } 9001007 - If the resource obtained by resId formatting error. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getStringSync(resource: Resource, ...args: Array): string; /** * Obtains string resources associated with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { string } The character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains string resources associated with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { string } The character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringByNameSync(resName: string): string; /** * Obtains string resources associated with a specified resource name. * * @param { string } resName - Indicates the resource name. * @param { Array } args - Indicates the formatting string resource parameters. * @returns { string } The character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @throws { BusinessError } 9001008 - If the resource obtained by resName formatting error. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringByNameSync(resName: string, ...args: Array): string; /** * Obtains the boolean result with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { boolean } The boolean resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the boolean result with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { boolean } The boolean resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getBoolean(resId: number): boolean; /** * Obtains the boolean result with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { boolean } The boolean resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the boolean result with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { boolean } The boolean resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getBoolean(resource: Resource): boolean; /** * Obtains the boolean result with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { boolean } The boolean resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the boolean result with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { boolean } The boolean resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getBooleanByName(resName: string): boolean; /** * Obtains the number result with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { number } The number resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the number result with a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { number } The number resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getNumber(resId: number): number; /** * Obtains the number result with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { number } The number resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 9 */ /** * Obtains the number result with a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { number } The number resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @crossplatform * @since 10 */ getNumber(resource: Resource): number; /** * Obtains the number result with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { number } The number resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the number result with a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { number } The number resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getNumberByName(resName: string): number; /** * Obtains release resourceManager. * * @syscap SystemCapability.Global.ResourceManager * @since 7 */ /** * Obtains release resourceManager. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ release(); /** * Obtains the character string corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the character string corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained character string. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringValue(resId: number, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains string resources associated with a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringValue(resId: number): Promise; /** * Obtains the array of character strings corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the obtained array of character strings. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringArrayValue(resId: number, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise> } The array of character strings corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise> } The array of character strings corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getStringArrayValue(resId: number): Promise>; /** * Obtains the singular-plural character string represented by the ID string corresponding to the * specified number in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the ID string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the singular-plural character string represented by the ID string corresponding to the * specified number in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the singular-plural character * string represented by the ID string corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getPluralStringValue(resId: number, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the ID string corresponding to * the specified number in Promise mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @returns { Promise } The singular-plural character string represented by the ID string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the singular-plural character string represented by the ID string corresponding to * the specified number in Promise mode. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @returns { Promise } The singular-plural character string represented by the ID string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getPluralStringValue(resId: number, num: number): Promise; /** * Obtains the content of the media file corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaContent(resId: number, callback: _AsyncCallback): void; /** * Obtains the content of the specified screen density media file corresponding to a specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained * specified screen density media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContent(resId: number, density: number, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The content of the media file corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } The content of the media file corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaContent(resId: number): Promise; /** * Obtains the content of the specified screen density media file corresponding to a specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } The content of the specified screen density media file corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContent(resId: number, density: number): Promise; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the image * resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaContentBase64(resId: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the obtained Base64 code of the * specified screen density image resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContentBase64(resId: number, density: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } the Base64 code of the image resource corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } the Base64 code of the image resource corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getMediaContentBase64(resId: number): Promise; /** * Obtains the Base64 code of the specified screen density image resource corresponding to the specified resource ID in Promise mode. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Promise } the Base64 code of the specified screen density image resource corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContentBase64(resId: number, density: number): Promise; /** * Obtains the raw file resource corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the raw file resource corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getRawFileContent(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } the raw file resource corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the raw file resource corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } the raw file resource corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getRawFileContent(path: string): Promise; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource descriptor. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return the raw file resource descriptor. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The raw file resource descriptor corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The raw file resource descriptor corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ getRawFd(path: string): Promise; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return result close raw file resource descriptor. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains close raw file resource descriptor corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to return result close raw file resource descriptor. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ closeRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The result close raw file resource descriptor corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise } The result close raw file resource descriptor corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ closeRawFd(path: string): Promise; /** * Obtains the DrawableDescriptor of the media file corresponding to a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { DrawableDescriptor } The DrawableDescriptor class to get drawable image. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getDrawableDescriptor(resId: number, density?: number): DrawableDescriptor; /** * Obtains the DrawableDescriptor of the media file corresponding to a specified resource Name. * * @param { string } resName - Indicates the resource name. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { DrawableDescriptor } The DrawableDescriptor class to get drawable image. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getDrawableDescriptorByName(resName: string, density?: number): DrawableDescriptor; /** * Obtains the DrawableDescriptor of the media file corresponding to a specified resource. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { DrawableDescriptor } The DrawableDescriptor class to get drawable image. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor; /** * Obtains the rawfile resource list corresponding to the specified resource path in callback mode. * * @param { string } path - Indicates the resource relative path. * @param { _AsyncCallback> } callback - Indicates the asynchronous callback used to return the raw file list. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getRawFileList(path: string, callback: _AsyncCallback>): void; /** * Obtains the rawfile resource list corresponding to the specified resource path in Promise mode. * * @param { string } path - Indicates the resource relative path. * @returns { Promise> } The rawfile list corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getRawFileList(path: string): Promise>; /** * Obtains the color resource corresponding to the specified resource ID in callback mode. * * @param { number } resId - Indicates the resource ID. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to * return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColor(resId: number, callback: _AsyncCallback): void; /** * Obtains the color resource corresponding to the specified resource ID in promise mode. * * @param { number } resId - Indicates the resource ID. * @returns { Promise } Indicates return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColor(resId: number): Promise; /** * Obtains the color resource corresponding to the specified resource object in callback mode. * * @param { Resource } resource - Indicates the resource object. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to * return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getColor(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the color resource corresponding to the specified resource object in promise mode. * * @param { Resource } resource - Indicates the resource object. * @returns { Promise } Indicates return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getColor(resource: Resource): Promise; /** * Obtains the color resource corresponding to the specified resource object in callback mode. * * @param { string } resName - Indicates the resource name. * @param { _AsyncCallback } callback - Indicates the asynchronous callback used to * return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColorByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the color resource corresponding to the specified resource object in promise mode. * * @param { string } resName - Indicates the resource name. * @returns { Promise } Indicates return the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColorByName(resName: string): Promise; /** * Obtains the color resource corresponding to the specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { number } Indicates the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColorSync(resId: number) : number; /** * Obtains the color resource corresponding to the specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { number } Indicates the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getColorSync(resource: Resource) : number; /** * Obtains the color resource corresponding to the specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { number } Indicates the integer reference value representing the color data. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getColorByNameSync(resName: string) : number; /** * Add overlay resources during application runtime. * * @param { string } path - Indicates the application overlay path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001010 - If loading the overlay failed. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ addResource(path: string) : void; /** * Remove overlay resources during application runtime. * * @param { string } path - Indicates the application overlay path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001010 - If loading the overlay failed. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ removeResource(path: string) : void; /** * Obtains the raw file resource descriptor corresponding to the specified resource path. * * @param { string } path - Indicates the resource relative path. * @returns { RawFileDescriptor } The raw file resource descriptor. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getRawFdSync(path: string): RawFileDescriptor; /** * Close the raw file resource descriptor corresponding to the specified resource path. * * @param { string } path - Indicates the resource relative path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ closeRawFdSync(path: string): void; /** * Obtains the rawfile resource list corresponding to the specified resource path. * * @param { string } path - Indicates the resource relative path. * @returns { Array } The rawfile resource list. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getRawFileListSync(path: string): Array; /** * Obtains the raw file resource corresponding to the specified resource path. * * @param { string } path - Indicates the resource relative path. * @returns { Uint8Array } the raw file resource corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getRawFileContentSync(path: string): Uint8Array; /** * Obtains the content of the specified screen density media file corresponding to a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Uint8Array } Indicates the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContentSync(resId: number, density?: number): Uint8Array; /** * Obtains the content of the specified screen density media file corresponding to a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Uint8Array } Indicates the obtained media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContentSync(resource: Resource, density?: number): Uint8Array; /** * Obtains the Base64 code of the specified screen density media file corresponding to the specified resource ID. * * @param { number } resId - Indicates the resource ID. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { string } Indicates the obtained Base64 code of the media file. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaContentBase64Sync(resId: number, density?: number): string; /** * Obtains the content of the specified screen density media file corresponding to the specified resource object. * * @param { Resource } resource - Indicates the resource object. * @param { number } density - The optional parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { string } Indicates the obtained Base64 code of the media file. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getMediaContentBase64Sync(resource: Resource, density?: number): string; /** * Obtains the singular-plural character string represented by the ID string corresponding to * the specified number. * * @param { number } resId - Indicates the resource ID. * @param { number } num - Indicates the number. * @returns { string } The singular-plural character string represented by the ID string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getPluralStringValueSync(resId: number, num: number): string; /** * Obtains the singular-plural character string represented by the resource object string corresponding to the * specified number. * * @param { Resource } resource - Indicates the resource object. * @param { number } num - Indicates the number. * @returns { string } The singular-plural character string represented by the ID string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getPluralStringValueSync(resource: Resource, num: number): string; /** * Obtains the array of character strings corresponding to a specified resource ID. * * @param { number } resId - Indicates the resource ID. * @returns { Array } The array of character strings corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getStringArrayValueSync(resId: number): Array; /** * Obtains the array of character strings corresponding to a specified resource object. * * @param { Resource } resource - Indicates the resource object. * @returns { Array } The array of character strings corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @stagemodelonly * @since 10 */ getStringArrayValueSync(resource: Resource): Array; /** * Obtains the singular-plural character string represented by the name string corresponding to * the specified number. * * @param { string } resName - Indicates the resource name. * @param { number } num - Indicates the number. * @returns { string } The singular-plural character string represented by the name string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getPluralStringByNameSync(resName: string, num: number): string; /** * Obtains the content of the specified screen density media file corresponding to a specified resource name. * * @param { string } resName - Indicates the resource name. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { Uint8Array } The obtained specified screen density media file content. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaByNameSync(resName: string, density?: number): Uint8Array; /** * Obtains the Base64 code of the specified screen density media file corresponding to the specified resource name. * * @param { string } resName - Indicates the resource name. * @param { number } density - The parameter ScreenDensity{@link ScreenDensity}, A value of 0 means * to use the density of current system dpi. * @returns { string } The obtained Base64 code of the specified screen density media file. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getMediaBase64ByNameSync(resName: string, density?: number): string; /** * Obtains the array of character strings corresponding to a specified resource name. * * @param { string } resName - Indicates the resource name. * @returns { Array } the array of character strings corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getStringArrayByNameSync(resName: string): Array; /** * Obtains the device configuration. * * @returns { Configuration } the device configuration. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getConfigurationSync(): Configuration; /** * Obtains the device capability. * * @returns { DeviceCapability } the device capability. * @syscap SystemCapability.Global.ResourceManager * @since 10 */ getDeviceCapabilitySync(): DeviceCapability; } /** * Contains rawFile descriptor information. * * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Contains rawFile descriptor information. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export type RawFileDescriptor = _RawFileDescriptor; /** * Contains resource descriptor information. * * @syscap SystemCapability.Global.ResourceManager * @since 9 */ /** * Contains resource descriptor information. * * @syscap SystemCapability.Global.ResourceManager * @crossplatform * @since 10 */ export type Resource = _Resource; } export default resourceManager;