openharmony 鸿蒙 capi-raw-file-manager-h

2026-08-25 浏览 (1)

raw_file_manager.h

Overview

Provides file management functions for the rawfile directory. You can use the ResourceManager to open a rawfile and perform operations such as data search and reading.

File to include: <rawfile/raw_file_manager.h>

Library: librawfile.z.so

System capability: SystemCapability.Global.ResourceManager

Since: 8

Related module: rawfile

Summary

Structs

Nametypedef KeywordDescription
NativeResourceManagerNativeResourceManagerRepresents the native ResourceManager. This class encapsulates the native implementation of the JavaScript resource manager. The ResourceManager pointer can be obtained by using OH_ResourceManager_InitNativeResourceManager.

Functions

NameDescription
NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr)Obtains the native ResourceManager based on the JavaScript ResourceManager to implement rawfile-specific functions.
void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr)Releases the native ResourceManager.
RawDir *OH_ResourceManager_OpenRawDir(const NativeResourceManager *mgr, const char *dirName)Traverses all files in the rawfile directory.
RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName)Opens a rawfile and reads the data in it.
RawFile64 *OH_ResourceManager_OpenRawFile64(const NativeResourceManager *mgr, const char *fileName)Opens a large rawfile and reads the data in it.
bool OH_ResourceManager_IsRawDir(const NativeResourceManager *mgr, const char *path)Checks whether the path of a rawfile is a subdirectory in the rawfile directory.

Function Description

OH_ResourceManager_InitNativeResourceManager()

NativeResourceManager *OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr)

Description

Obtains the native ResourceManager based on the JavaScript ResourceManager to implement rawfile-specific functions.

Since: 8

Parameters

NameDescription
napi_env envPointer to the JavaScript Native API (napi) environment.
napi_value jsResMgrJavaScript ResourceManager object.

Returns

TypeDescription
NativeResourceManager *Pointer to NativeResourceManager. If the operation fails, a null pointer is returned.

OH_ResourceManager_ReleaseNativeResourceManager()

void OH_ResourceManager_ReleaseNativeResourceManager(NativeResourceManager *resMgr)

Description

Releases the native ResourceManager.

Since: 8

Parameters

NameDescription
NativeResourceManager *resMgrPointer to NativeResourceManager.

OH_ResourceManager_OpenRawDir()

RawDir *OH_ResourceManager_OpenRawDir(const NativeResourceManager *mgr, const char *dirName)

Description

Traverses all files in the rawfile directory.

Since: 8

Parameters

NameDescription
const NativeResourceManager *mgrPointer to NativeResourceManager, which is obtained by calling OH_ResourceManager_InitNativeResourceManager.
const char *dirNamePointer to the name of the directory to open. If this field is left empty, the root directory will be opened.

Returns

TypeDescription
RawDir *Pointer to RawDir. After using the pointer, call OH_ResourceManager_CloseRawDir to release it. If the operation fails or mgr is empty, a null pointer is returned.

Reference

OH_ResourceManager_InitNativeResourceManager

OH_ResourceManager_CloseRawDir

OH_ResourceManager_OpenRawFile()

RawFile *OH_ResourceManager_OpenRawFile(const NativeResourceManager *mgr, const char *fileName)

Description

Opens a rawfile and reads the data in it.

Since: 8

Parameters

NameDescription
const NativeResourceManager *mgrPointer to NativeResourceManager, which is obtained by calling OH_ResourceManager_InitNativeResourceManager.
const char *fileNamePointer to the name of the file in the relative path of the rawfile root directory.

Returns

TypeDescription
RawFile *Pointer to RawFile. After using the pointer, call OH_ResourceManager_CloseRawFile to release it. If the operation fails or mgr or fileName is empty, a null pointer is returned.

Reference

OH_ResourceManager_InitNativeResourceManager

OH_ResourceManager_CloseRawFile

OH_ResourceManager_OpenRawFile64()

RawFile64 *OH_ResourceManager_OpenRawFile64(const NativeResourceManager *mgr, const char *fileName)

Description

Opens a large rawfile and reads the data in it.

Since: 11

Parameters

NameDescription
const NativeResourceManager *mgrPointer to NativeResourceManager, which is obtained by calling OH_ResourceManager_InitNativeResourceManager.
const char *fileNamePointer to the name of the file in the relative path of the rawfile root directory.

Returns

TypeDescription
RawFile64 *Pointer to RawFile64. After using this pointer, call OH_ResourceManager_CloseRawFile64 to release it. If the operation fails or mgr or fileName is empty, a null pointer is returned.

Reference

OH_ResourceManager_InitNativeResourceManager

OH_ResourceManager_CloseRawFile64

OH_ResourceManager_IsRawDir()

bool OH_ResourceManager_IsRawDir(const NativeResourceManager *mgr, const char *path)

Description

Checks whether the path of a raw file is a subdirectory in the rawfile directory.

Since: 12

Parameters

NameDescription
const NativeResourceManager *mgrPointer to NativeResourceManager, which is obtained by calling OH_ResourceManager_InitNativeResourceManager.
const char *pathPath of a rawfile.

Returns

TypeDescription
booltrue if the path is a subdirectory in the rawfile directory; false otherwise.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-i18n-initialtimezonerule

openharmony 鸿蒙 capi-i18n-timezonerules

openharmony 鸿蒙 capi-resmgr-common-h

openharmony 鸿蒙 capi-i18n-annualtimezonerule

openharmony 鸿蒙 errorcode-font-manager

openharmony 鸿蒙 capi-raw-dir-h

openharmony 鸿蒙 capi-i18n-timezonerulequery

openharmony 鸿蒙 capi-errorcode-h

openharmony 鸿蒙 js-apis-resource-manager

openharmony 鸿蒙 js-apis-sendableResource

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/aPyiZMjW