开发者

How to read a local (res/raw) file line by line?

开发者 https://www.devze.com 2023-01-06 12:36 出处:网络
I have a text file in my res/raw directory. I want to read the file line by l开发者_如何学Cine, but FileReader and BufferedReader fail, because of Android\'s security restriction. How else can I do it

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


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


A DataInputStream allows you to do a readLine (along with a host of other operations); see DataInputStream Reference.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号