【发布时间】:2012-04-11 00:20:07
【问题描述】:
我已创建此代码以将 pdf 文件保存在 sd 卡中,但我想将保存文件的目录从 /sdcard/ 更改为 /sdcard/MYDIR/
try {
URL url = new URL(f_url[0]);
URLConnection conection = url.openConnection();
conection.connect();
// getting file length
int lenghtOfFile = conection.getContentLength();
// input stream to read file - with 8k buffer
InputStream input = new BufferedInputStream(url.openStream(), 8192);
// Output stream to write file
OutputStream output = new FileOutputStream("/sdcard/yes.pdf");
【问题讨论】:
-
必须创建目录并查看它是否已经存在
-
如何创建目录?我不知道代码..