当前位置:网站首页>鸿蒙读取资源文件
鸿蒙读取资源文件
2022-06-23 08:07:00 【helwens】
在鸿蒙读取外部资源文件的API为getRawFile
但是这个方法的使用有些蹊跷
按照官方文档:
文档中心
https://developer.harmonyos.com/cn/docs/documentation/doc-guides/basic-resource-file-example-0000001051733014#section126348226453首先把外部资源文件存放在resource/rawfile内
读取时只需要
this.getResourceManager().getRawFileEntry("resources/rawfile/models");
即可读取,这个resources/rawfile不能去掉,必须保留才能读取得到
有一次在使用
this.getResourceManager().getRawFileEntry("models");无法读取文件,原因就在这里
然而还有一种情况,就是到了后面openrawfile就会出错
this.getResourceManager().getRawFileEntry("resources/rawfile/labels/labelmap”).openRawFile()会直接报错
java.io.FileNotFoundException: resources/rawfile/labels/labelmap
此时要改成“entry/resources/rawfile/labels/labelmap” 加上entry就不会报错
所以保险一点还是要有entry
边栏推荐
- MySQL common skills
- 9 ways in which network security may change in 2022
- Markdown学习
- View the file once a second and send the result of the last line of the file to the syslog server
- Capturing packets to find repeated acks and a large number of TCP retransmissions in TCP sessions -- sack (selective acknowledgement) technology
- Deep learning ----- different methods to realize vgg16
- 史上最污技术解读,60 个 IT 术语我居然秒懂了......
- How to migrate x86 architecture applications to arm architecture at low cost
- INT 104_ LEC 06
- After easynvr video is enabled, no video file is generated. How to solve this problem?
猜你喜欢

图像分割-改进网络结构

INT 104_ LEC 06

为什么用生长型神经气体网络(GNG)?

Commonly used bypass methods for SQL injection -ctf

【论文笔记】Catching Both Gray and Black Swans: Open-set Supervised Anomaly Detection*

INT 104_LEC 06

81 sentences worth repeating

PCB电路板特性检查项目都有哪些?

Vulnhub | DC: 3 |【实战】

VTK. Le bouton gauche de la souris JS glisse pour changer le niveau et la largeur de la fenêtre
随机推荐
There are some limitations in cluster expansion and contraction
Focus! Ten minutes to master Newton convex optimization
How to migrate x86 architecture applications to arm architecture at low cost
复选框的基本使用与实现全选和反选功能
如何在conda虚拟环境开启jupyter-notebook
Odoo project sends information to wechat official account or enterprise wechat
【云计算】GFS思想优势以及架构
华为云服务器弹性公网IP无法ping
List接口三个子实现类
How can easycvr access the Dahua CVS video recorder and download a video file with an empty name?
Ignore overlength parameter violation
Multi Chain and cross chain are the future
View the file once a second and send the result of the last line of the file to the syslog server
Socket programming (multi process)
Multi-scale feature combination in target detection
Configuration asmx not accessible
1-渐变、阴影和文本
Moodle e-learning platform fixes the session hijacking error that leads to pre authorized rce
词性家族
Openvino series 18 Real time object recognition through openvino and opencv (RTSP, USB video reading and video file reading)