1# Rawfile
2
3
4## Overview
5
6Provides the function of operating rawfile directories and rawfiles. You can use the APIs to traverse, open, search for, read, and close raw files. The **rawfile** APIs are non-thread-safe, and the **close** and **open** APIs are thread-safe.
7
8**Since**: 8
9
10
11## Summary
12
13
14### Files
15
16| Name| Description|
17| -------- | -------- |
18| [raw_dir.h](raw__dir_8h.md) | Provides functions related to the **rawfile** directory.|
19| [raw_file.h](raw__file_8h.md) | Provides functions related to rawfiles, including searching for, reading, and closing rawfiles.|
20| [raw_file_manager.h](raw__file__manager_8h.md) | 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.|
21
22
23### Structs
24
25| Name| Description|
26| -------- | -------- |
27| struct  [RawFileDescriptor](_raw_file_descriptor.md) | Defines the file descriptor information of a file in the **rawfile** directory.|
28| struct  [RawFileDescriptor64](_raw_file_descriptor64.md) | Defines the file descriptor of a large rawfile.|
29
30
31### Types
32
33| Name| Description|
34| -------- | -------- |
35| typedef struct [RawDir](#rawdir)[RawDir](#rawdir) | Provides access to the **rawfile** directory.|
36| typedef struct [RawFile](#rawfile)[RawFile](#rawfile) | Provides access to rawfiles.|
37| typedef struct [RawFile64](#rawfile64)[RawFile64](#rawfile64) | Provides access to large rawfiles.|
38| typedef struct [NativeResourceManager](#nativeresourcemanager)[NativeResourceManager](#nativeresourcemanager) | Represents the native **ResourceManager**.|
39
40
41### Functions
42
43| Name| Description|
44| -------- | -------- |
45| const char \* [OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename) ([RawDir](#rawdir) \*rawDir, int index) | Obtains the name of a file in **rawfile** based on the index.|
46| int [OH_ResourceManager_GetRawFileCount](#oh_resourcemanager_getrawfilecount) ([RawDir](#rawdir) \*rawDir) | Obtains the number of files in a [RawDir](#rawdir).|
47| void [OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir) ([RawDir](#rawdir) \*rawDir) | Closes a [RawDir](#rawdir) and releases all associated resources.|
48| int [OH_ResourceManager_ReadRawFile](#oh_resourcemanager_readrawfile) (const [RawFile](#rawfile) \*rawFile, void \*buf, size_t length) | Reads data of the specified length from the current position in a rawfile.|
49| int [OH_ResourceManager_SeekRawFile](#oh_resourcemanager_seekrawfile) (const [RawFile](#rawfile) \*rawFile, long offset, int whence) | Searches for the data read/write position in a rawfile based on the specified offset.|
50| long [OH_ResourceManager_GetRawFileSize](#oh_resourcemanager_getrawfilesize) ([RawFile](#rawfile) \*rawFile) | Obtains the length of the rawfile, in long.|
51| long [OH_ResourceManager_GetRawFileRemainingLength](#oh_resourcemanager_getrawfileremaininglength) (const [RawFile](#rawfile) \*rawFile) | Obtains the remaining length of the rawfile, in long.|
52| void [OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile) ([RawFile](#rawfile) \*rawFile) | Closes a [RawFile](#rawfile) and releases all associated resources.|
53| long [OH_ResourceManager_GetRawFileOffset](#oh_resourcemanager_getrawfileoffset) (const [RawFile](#rawfile) \*rawFile) | Obtains the current offset of a rawfile, in long.|
54| bool [OH_ResourceManager_GetRawFileDescriptor](#oh_resourcemanager_getrawfiledescriptor) (const [RawFile](#rawfile) \*rawFile, [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | Opens a rawfile based on the specified offset (in long) and file length (in long) and obtains the file descriptor.|
55| bool [OH_ResourceManager_ReleaseRawFileDescriptor](#oh_resourcemanager_releaserawfiledescriptor) (const [RawFileDescriptor](_raw_file_descriptor.md) &descriptor) | Releases a file descriptor.|
56| int64_t [OH_ResourceManager_ReadRawFile64](#oh_resourcemanager_readrawfile64) (const [RawFile64](#rawfile64) \*rawFile, void \*buf, int64_t length) | Reads data of the specified length from the current position in a large rawfile.|
57| int [OH_ResourceManager_SeekRawFile64](#oh_resourcemanager_seekrawfile64) (const [RawFile64](#rawfile64) \*rawFile, int64_t offset, int whence) | Searches for the data read/write position in a large rawfile based on the specified offset.|
58| int64_t [OH_ResourceManager_GetRawFileSize64](#oh_resourcemanager_getrawfilesize64) ([RawFile64](#rawfile64) \*rawFile) | Obtains the length of a large rawfile, in int64_t.|
59| int64_t [OH_ResourceManager_GetRawFileRemainingLength64](#oh_resourcemanager_getrawfileremaininglength64) (const [RawFile64](#rawfile64) \*rawFile) | Obtains the remaining length of a large rawfile, in int64_t.|
60| void [OH_ResourceManager_CloseRawFile64](#oh_resourcemanager_closerawfile64) ([RawFile64](#rawfile64) \*rawFile) | Closes a [RawFile64](#rawfile64) and releases all associated resources.|
61| int64_t [OH_ResourceManager_GetRawFileOffset64](#oh_resourcemanager_getrawfileoffset64) (const [RawFile64](#rawfile64) \*rawFile) | Obtains the offset of a large rawfile, in int64_t.|
62| bool [OH_ResourceManager_GetRawFileDescriptor64](#oh_resourcemanager_getrawfiledescriptor64) (const [RawFile64](#rawfile64) \*rawFile, [RawFileDescriptor64](_raw_file_descriptor64.md) \*descriptor) | Opens a large rawfile based on the specified offset (in int64_t) and file length (in int64_t) and obtains the file descriptor.|
63| bool [OH_ResourceManager_ReleaseRawFileDescriptor64](#oh_resourcemanager_releaserawfiledescriptor64) (const [RawFileDescriptor64](_raw_file_descriptor64.md) \*descriptor) | Releases a file descriptor.|
64| [NativeResourceManager](#nativeresourcemanager) \* [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager) (napi_env env, napi_value jsResMgr) | Obtains the native **ResourceManager** based on the JS **ResourceManager** to implement rawfile-specific functions.|
65| void [OH_ResourceManager_ReleaseNativeResourceManager](#oh_resourcemanager_releasenativeresourcemanager) ([NativeResourceManager](#nativeresourcemanager) \*resMgr) | Releases the native **ResourceManager**.|
66| [RawDir](#rawdir) \* [OH_ResourceManager_OpenRawDir](#oh_resourcemanager_openrawdir) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*dirName) | Traverses all files in the **rawfile** directory.|
67| [RawFile](#rawfile) \* [OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*fileName) | Opens a rawfile and reads the data in it.|
68| [RawFile64](#rawfile64) \* [OH_ResourceManager_OpenRawFile64](#oh_resourcemanager_openrawfile64) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*fileName) | Opens a large rawfile and reads the data in it.|
69| bool [OH_ResourceManager_IsRawDir](#oh_resourcemanager_israwdir) (const [NativeResourceManager](#nativeresourcemanager) \*mgr, const char \*path) | Checks whether a path is a subdirectory in the **rawfile** directory.|
70
71
72## Type Description
73
74
75### NativeResourceManager
76
77```
78typedef struct NativeResourceManagerNativeResourceManager
79```
80
81**Description**
82
83Represents the native **ResourceManager**.
84
85This class encapsulates the native implementation of the JavaScript resource manager. The **ResourceManager** pointer can be obtained by using [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager).
86
87**Since**: 8
88
89
90### RawDir
91
92```
93typedef struct RawDirRawDir
94```
95
96**Description**
97
98Provides access to the **rawfile** directory.
99
100**Since**: 8
101
102
103### RawFile
104
105```
106typedef struct RawFileRawFile
107```
108
109**Description**
110
111Provides access to rawfiles.
112
113**Since**: 8
114
115
116### RawFile64
117
118```
119typedef struct RawFile64RawFile64
120```
121
122**Description**
123
124Provides access to large rawfiles.
125
126**Since**: 11
127
128
129## Function Description
130
131
132### OH_ResourceManager_CloseRawDir()
133
134```
135void OH_ResourceManager_CloseRawDir (RawDir * rawDir)
136```
137
138**Description**
139
140Closes a [RawDir](#rawdir) opened and releases all associated resources.
141
142**Since**: 8
143
144**Parameters**
145
146| Name| Description|
147| -------- | -------- |
148| rawDir | Pointer to the [RawDir](#rawdir).|
149
150**See**
151
152[OH_ResourceManager_OpenRawDir](#oh_resourcemanager_openrawdir)
153
154
155### OH_ResourceManager_CloseRawFile()
156
157```
158void OH_ResourceManager_CloseRawFile (RawFile * rawFile)
159```
160
161**Description**
162
163Closes a [RawFile](#rawfile) and releases all associated resources.
164
165**Since**: 8
166
167**Parameters**
168
169| Name| Description|
170| -------- | -------- |
171| rawFile | Pointer to the [RawFile](#rawfile) to read.|
172
173**See**
174
175[OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile)
176
177
178### OH_ResourceManager_CloseRawFile64()
179
180```
181void OH_ResourceManager_CloseRawFile64 (RawFile64 * rawFile)
182```
183
184**Description**
185
186Closes a [RawFile64](#rawfile64) and releases all associated resources.
187
188**Since**: 11
189
190**Parameters**
191
192| Name| Description|
193| -------- | -------- |
194| rawFile | Pointer to [RawFile64](#rawfile64).|
195
196**See**
197
198[OH_ResourceManager_OpenRawFile64](#oh_resourcemanager_openrawfile64)
199
200
201### OH_ResourceManager_GetRawFileCount()
202
203```
204int OH_ResourceManager_GetRawFileCount (RawDir * rawDir)
205```
206
207**Description**
208
209Obtains the number of files in a [RawDir](#rawdir).
210
211You can use this function to obtain available indexes in [OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename).
212
213**Since**: 8
214
215**Parameters**
216
217| Name| Description|
218| -------- | -------- |
219| rawDir | Pointer to the [RawDir](#rawdir).|
220
221**See**
222
223[OH_ResourceManager_GetRawFileName](#oh_resourcemanager_getrawfilename)
224
225**Returns**
226
227Number of files in **rawDir**. If **rawDir** is empty, **0** is returned.
228
229
230### OH_ResourceManager_GetRawFileDescriptor()
231
232```
233bool OH_ResourceManager_GetRawFileDescriptor (const RawFile * rawFile, RawFileDescriptor & descriptor )
234```
235
236**Description**
237
238Opens a rawfile based on the specified offset (in long) and file length (in long) and obtains the file descriptor.
239
240The file descriptor obtained can be used to read the file.
241
242**Since**: 8
243
244**Parameters**
245
246| Name| Description|
247| -------- | -------- |
248| rawFile | Pointer to the [RawFile](#rawfile) to read.|
249| descriptor | File descriptor of the rawfile, start position of the rawfile in the HAP, and length of the rawfile.|
250
251**Returns**
252
253<b>true</b> if the file is opened; returns <b>false</b> if the access to the file is rejected.
254
255
256### OH_ResourceManager_GetRawFileDescriptor64()
257
258```
259bool OH_ResourceManager_GetRawFileDescriptor64 (const RawFile64 * rawFile, RawFileDescriptor64 * descriptor )
260```
261
262**Description**
263
264Opens a large rawfile based on the specified offset (in int64_t) and file length (in int64_t) and obtains the file descriptor.
265
266The file descriptor obtained can be used to read the file.
267
268**Since**: 11
269
270**Parameters**
271
272| Name| Description|
273| -------- | -------- |
274| rawFile | Pointer to [RawFile64](#rawfile64).|
275| File descriptor of the rawfile, start position of the rawfile in the HAP, and length of the rawfile.|  |
276
277**Returns**
278
279<b>true</b> if the file is opened; <b>false</b> if the access to the file is rejected.
280
281
282### OH_ResourceManager_GetRawFileName()
283
284```
285const char* OH_ResourceManager_GetRawFileName (RawDir * rawDir, int index )
286```
287
288**Description**
289
290Obtain the name of the rawfile file through the index. You can use this method to traverse the rawfile directory.
291
292**Since**: 8
293
294**Parameters**
295
296| Name| Description|
297| -------- | -------- |
298| rawDir | Pointer to the [RawDir](#rawdir).|
299| index | Index of the file in the [RawDir](#rawdir).|
300
301**Returns**
302
303File name obtained if the rawfile exists in the directory; returns **null** otherwise. The file name returned can be used as the input parameter of [OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile).
304
305**See**
306
307[OH_ResourceManager_OpenRawFile](#oh_resourcemanager_openrawfile)
308
309
310### OH_ResourceManager_GetRawFileOffset()
311
312```
313long OH_ResourceManager_GetRawFileOffset (const RawFile * rawFile)
314```
315
316**Description**
317
318Obtains the current offset of a rawfile, in long.
319
320Current offset of the rawfile.
321
322**Since**: 8
323
324**Parameters**
325
326| Name| Description|
327| -------- | -------- |
328| rawFile | Pointer to the [RawFile](#rawfile) to read.|
329
330**Returns**
331
332Current offset of the rawfile. If the rawfile is empty, **0** is returned.
333
334
335### OH_ResourceManager_GetRawFileOffset64()
336
337```
338int64_t OH_ResourceManager_GetRawFileOffset64 (const RawFile64 * rawFile)
339```
340
341**Description**
342
343Obtains the offset of a large rawfile, in int64_t.
344
345**Since**: 11
346
347**Parameters**
348
349| Name| Description|
350| -------- | -------- |
351| rawFile | Pointer to [RawFile64](#rawfile64).|
352
353**Returns**
354
355Returns the current offset of the rawfile. If the rawfile is empty, 0 is returned.
356
357
358### OH_ResourceManager_GetRawFileRemainingLength()
359
360```
361long OH_ResourceManager_GetRawFileRemainingLength (const RawFile * rawFile)
362```
363
364**Description**
365
366Obtains the remaining length of the rawfile, in long.
367
368**Since**: 11
369
370**Parameters**
371
372| Name| Description|
373| -------- | -------- |
374| rawFile | Pointer to the [RawFile](#rawfile) to read.|
375
376**Returns**
377
378Remaining length of the rawfile. If the rawfile is empty, **0** is returned.
379
380
381### OH_ResourceManager_GetRawFileRemainingLength64()
382
383```
384int64_t OH_ResourceManager_GetRawFileRemainingLength64 (const RawFile64 * rawFile)
385```
386
387**Description**
388
389Obtains the remaining length of a large rawfile, in int64_t.
390
391**Since**: 11
392
393**Parameters**
394
395| Name| Description|
396| -------- | -------- |
397| rawFile | Pointer to [RawFile64](#rawfile64).|
398
399**Returns**
400
401Remaining length of the rawfile. If the rawfile is empty, **0** is returned.
402
403
404### OH_ResourceManager_GetRawFileSize()
405
406```
407long OH_ResourceManager_GetRawFileSize (RawFile * rawFile)
408```
409
410**Description**
411
412Obtains the length of the rawfile, in long.
413
414**Since**: 8
415
416**Parameters**
417
418| Name| Description|
419| -------- | -------- |
420| rawFile | Pointer to the [RawFile](#rawfile) to read.|
421
422**Returns**
423
424Overall length of the rawfile. If the rawfile is empty, **0** is returned.
425
426
427### OH_ResourceManager_GetRawFileSize64()
428
429```
430int64_t OH_ResourceManager_GetRawFileSize64 (RawFile64 * rawFile)
431```
432
433**Description**
434
435Obtains the length of a large rawfile, in int64_t.
436
437**Since**: 11
438
439**Parameters**
440
441| Name| Description|
442| -------- | -------- |
443| rawFile | Pointer to [RawFile64](#rawfile64).|
444
445**Returns**
446
447Overall length of the rawfile. If the rawfile is empty, **0** is returned.
448
449
450### OH_ResourceManager_InitNativeResourceManager()
451
452```
453NativeResourceManager* OH_ResourceManager_InitNativeResourceManager (napi_env env, napi_value jsResMgr )
454```
455
456**Description**
457
458Obtains the native **ResourceManager** based on the JS **ResourceManager** to implement rawfile-specific functions.
459
460**Since**: 8
461
462**Parameters**
463
464| Name| Description|
465| -------- | -------- |
466| env | Pointer to the JS native API (napi) environment.|
467| jsResMgr | JS **ResourceManager**.|
468
469**Returns**
470
471Pointer to [NativeResourceManager](#nativeresourcemanager). If the operation fails, a null pointer is returned.
472
473
474### OH_ResourceManager_IsRawDir()
475
476```
477bool OH_ResourceManager_IsRawDir (const NativeResourceManager * mgr, const char * path )
478```
479
480**Description**
481
482Checks whether a path is a subdirectory in the **rawfile** directory.
483
484**Since**: 12
485
486**Parameters**
487
488| Name| Description|
489| -------- | -------- |
490| mgr | Pointer to the [NativeResourceManager](#nativeresourcemanager), which is obtained by using [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager).|
491| path | Path of a rawfile.|
492
493**Returns**
494
495**true** if the path is a subdirectory in the **rawfile** directory; **false** otherwise.
496
497
498### OH_ResourceManager_OpenRawDir()
499
500```
501RawDir* OH_ResourceManager_OpenRawDir (const NativeResourceManager * mgr, const char * dirName )
502```
503
504**Description**
505
506Traverses all files in the **rawfile** directory.
507
508**Since**: 8
509
510**Parameters**
511
512| Name| Description|
513| -------- | -------- |
514| mgr | Pointer to the [NativeResourceManager](#nativeresourcemanager), which is obtained by using [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager).|
515| dirName | Pointer to the name of the directory to open. If this field is left empty, the root directory will be opened.|
516
517**Returns**
518
519Pointer to the [RawDir](#rawdir). You can use [OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir) to close the directory and release resources. If the operation fails or **mgr** is empty, a null pointer is returned.
520
521**See**
522
523[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)
524
525[OH_ResourceManager_CloseRawDir](#oh_resourcemanager_closerawdir)
526
527
528### OH_ResourceManager_OpenRawFile()
529
530```
531RawFile* OH_ResourceManager_OpenRawFile (const NativeResourceManager * mgr, const char * fileName )
532```
533
534**Description**
535
536Opens a rawfile and reads the data in it.
537
538**Since**: 8
539
540**Parameters**
541
542| Name| Description|
543| -------- | -------- |
544| mgr | Pointer to the [NativeResourceManager](#nativeresourcemanager), which is obtained by using [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager).|
545| fileName | Pointer to the name of the file in the relative path of the **rawfile** root directory.|
546
547**Returns**
548
549Pointer to the [RawFile](#rawfile) opened. You can use [OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile) to close the rawfile and release resources. If the operation fails or **mgr** or **fileName** is empty, a null pointer is returned.
550
551**See**
552
553[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)
554
555[OH_ResourceManager_CloseRawFile](#oh_resourcemanager_closerawfile)
556
557
558### OH_ResourceManager_OpenRawFile64()
559
560```
561RawFile64* OH_ResourceManager_OpenRawFile64 (const NativeResourceManager * mgr, const char * fileName )
562```
563
564**Description**
565
566Opens a large rawfile and reads the data in it.
567
568**Since**: 11
569
570**Parameters**
571
572| Name| Description|
573| -------- | -------- |
574| mgr | Pointer to the [NativeResourceManager](#nativeresourcemanager), which is obtained by using [OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager).|
575| fileName | Pointer to the name of the file in the relative path of the **rawfile** root directory.|
576
577**Returns**
578
579Pointer to [RawFile64](#rawfile64). After this pointer is used, call [OH_ResourceManager_CloseRawFile64](#oh_resourcemanager_closerawfile64) to release it. If the operation fails or **mgr** or **fileName** is empty, a null pointer is returned.
580
581**See**
582
583[OH_ResourceManager_InitNativeResourceManager](#oh_resourcemanager_initnativeresourcemanager)
584
585[OH_ResourceManager_CloseRawFile64](#oh_resourcemanager_closerawfile64)
586
587
588### OH_ResourceManager_ReadRawFile()
589
590```
591int OH_ResourceManager_ReadRawFile (const RawFile * rawFile, void * buf, size_t length )
592```
593
594**Description**
595
596Reads data of the specified length from the current position in a rawfile.
597
598**Since**: 8
599
600**Parameters**
601
602| Name| Description|
603| -------- | -------- |
604| rawFile | Pointer to the [RawFile](#rawfile) to read.|
605| buf | Pointer to the buffer for receiving the read data.|
606| length | Length of the data to read.|
607
608**Returns**
609
610Number of read bytes. If the read length exceeds the length of the file end or rawfile is empty, **0** is returned.
611
612
613### OH_ResourceManager_ReadRawFile64()
614
615```
616int64_t OH_ResourceManager_ReadRawFile64 (const RawFile64 * rawFile, void * buf, int64_t length )
617```
618
619**Description**
620
621Reads data of the specified length from the current position in a large rawfile.
622
623**Since**: 11
624
625**Parameters**
626
627| Name| Description|
628| -------- | -------- |
629| rawFile | Pointer to [RawFile64](#rawfile64).|
630| buf | Pointer to the buffer for receiving the read data.|
631| length | Length of the data to read.|
632
633**Returns**
634
635Number of read bytes. If the read length exceeds the length of the file end or rawfile is empty, **0** is returned.
636
637
638### OH_ResourceManager_ReleaseNativeResourceManager()
639
640```
641void OH_ResourceManager_ReleaseNativeResourceManager (NativeResourceManager * resMgr)
642```
643
644**Description**
645
646Releases the native **ResourceManager**.
647
648**Since**: 8
649
650**Parameters**
651
652| Name| Description|
653| -------- | -------- |
654| resMgr | Pointer to the [NativeResourceManager](#nativeresourcemanager) instance to release.|
655
656
657### OH_ResourceManager_ReleaseRawFileDescriptor()
658
659```
660bool OH_ResourceManager_ReleaseRawFileDescriptor (const RawFileDescriptor & descriptor)
661```
662
663**Description**
664
665Releases the file descriptor of a file in **rawfile**.
666
667To prevent file descriptor leakage, you are advised to release a rawfile descriptor immediately after use.
668
669**Since**: 8
670
671**Parameters**
672
673| Name| Description|
674| -------- | -------- |
675| descriptor | File descriptor of the rawfile. It contains the file descriptor, start position in the HAP, and file length.|
676
677**Returns**
678
679Returns <b>true</b> if the file descriptor is released; returns <b>false</b> otherwise.
680
681
682### OH_ResourceManager_ReleaseRawFileDescriptor64()
683
684```
685bool OH_ResourceManager_ReleaseRawFileDescriptor64 (const RawFileDescriptor64 * descriptor)
686```
687
688**Description**
689
690Releases the file descriptor of a file in **rawfile**.
691
692To prevent file descriptor leakage, you are advised to release a rawfile descriptor immediately after use.
693
694**Since**: 11
695
696**Parameters**
697
698| Name| Description|
699| -------- | -------- |
700| descriptor | File descriptor of the rawfile. It contains the file descriptor, start position in the HAP, and file length.|
701
702**Returns**
703
704<b>true</b> if the file descriptor is released; <b>false</b> otherwise.
705
706
707### OH_ResourceManager_SeekRawFile()
708
709```
710int OH_ResourceManager_SeekRawFile (const RawFile * rawFile, long offset, int whence )
711```
712
713**Description**
714
715Searches for the data read/write position in a rawfile based on the specified offset.
716
717**Since**: 8
718
719**Parameters**
720
721| Name| Description|
722| -------- | -------- |
723| rawFile | Pointer to the [RawFile](#rawfile) to read.|
724| offset | Specified offset.|
725| whence | Read/Write position. The options are as follows:<br>**0**: The read/write position is the start position of the file plus the offset.<br>**1**: The read/write position is the current position plus the offset.<br>**2**: The read/write position is the end position of the file plus the offset.|
726
727**Returns**
728
729**0** if the search is successful; **-1** otherwise.
730
731
732### OH_ResourceManager_SeekRawFile64()
733
734```
735int OH_ResourceManager_SeekRawFile64 (const RawFile64 * rawFile, int64_t offset, int whence )
736```
737
738**Description**
739
740Searches for the data read/write position in a large rawfile based on the specified offset.
741
742**Since**: 11
743
744**Parameters**
745
746| Name| Description|
747| -------- | -------- |
748| rawFile | Pointer to [RawFile64](#rawfile64).|
749| offset | Specified offset.|
750| whence | Read/Write position. The options are as follows:<br>**0**: The read/write position is the start position of the file plus the offset.<br>**1**: The read/write position is the current position plus the offset.<br>**2**: The read/write position is the end position of the file plus the offset.|
751
752**Returns**
753
754**0** if the search is successful; **-1** otherwise.
755