当使用的FileOutputStream在Android上创建文件? [英] Where are files created using FileOutputStream on Android?
本文介绍了当使用的FileOutputStream在Android上创建文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的code创建的文件,如下图所示。
I've created a file in my code, as shown below
FileOutputStream fOut = openFileOutput("samplefile.txt", MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(text);
osw.flush();
osw.close();
现在,我知道该文件是越来越创建,因为我可以读取该文件,当我做到这一点:
Now, I know that the file is getting created because I can read the file when I do this:
FileInputStream fIn = openFileInput("samplefile.txt");
InputStreamReader isr = new InputStreamReader(fIn);
char[] inputBuffer = new char[text.length()];
isr.read(inputBuffer);
String readString = new String(inputBuffer);
System.out.println(readString);
,使文本得到回读。 但是,我找不到我的设备上的文件。它在哪里去了?
So the text is getting read back. However, I can't find the file on my device. Where does it go?
在此先感谢。
推荐答案
您可以得到它的地址是低于线code
You can get the address of it be below line Code
File file = getFileStreamPath("samplefile.txt");
和打印它
String s = file.getAbsolutePath();
这篇关于当使用的FileOutputStream在Android上创建文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文