如何读取本地(RES / RAW)文件一行行? [英] How to read a local (res/raw) file line by line?

查看:104
本文介绍了如何读取本地(RES / RAW)文件一行行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的RES /原料目录下的文本文件。我想逐行读取文件中的行,但的FileReader和BufferedReader失败,因为Android的安全限制。我还能怎么办呢?

I have a text file in my res/raw directory. I want to read the file line by line, but FileReader and BufferedReader fail, because of Android's security restriction. How else can I do it?

推荐答案

getResources()。openRawResource()返回的InputStream 这应该是行由行阅读使用。

getResources().openRawResource() returns an InputStream that should be usable for line-by-line reading.

这篇关于如何读取本地(RES / RAW)文件一行行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆