从资产的文件夹的InputStream在Android返回空 [英] InputStream from Assets folder on Android returning empty
本文介绍了从资产的文件夹的InputStream在Android返回空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我没有得到任何异常,但是当我跑...
I'm not getting any exceptions, but when I run...
InputStream deckFile = context.getAssets().open("cards.txt");
然后,deckFile.read()返回-1。该文件是在正确的文件夹,它不是空的。
Then, deckFile.read() returns -1. The file is in the correct folder, and it is NOT empty.
这应该是世界上最容易的事情...
This should be the easiest thing in the world...
编辑:该AssetManager确实上市cards.txt作为在那里,所以这不应该成为问题。
The AssetManager is indeed listing "cards.txt" as being there, so that shouldn't be the problem.
推荐答案
的问题是,我的文件太大,并正在融为一体pressed,因为它是.TXT延伸。通过将文件重命名为一个格式,通常是COM pressed,.MP3,没有出现问题。
The problem was that my file was too big, and was being compressed because of it's ".txt" extension. By renaming the file to a format that is normally compressed, ".mp3", there was no issue
这篇关于从资产的文件夹的InputStream在Android返回空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文