如何保存文件到SD卡 [英] How to save file to sd card
本文介绍了如何保存文件到SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有点新的Android和Java编程,可有人告诉我如何保存这些文件,我有以下的codeS:
I'm kinda new to android and java programming, can someone tell me how to save the files, I have the following codes:
InputStream is = new FileInputStream( location + "/zipSample.zip");
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is));
try {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int count;
while ((count = zis.read(buffer)) != -1) {
baos.write(buffer, 0, count);
}
String filename = ze.getName();
byte[] bytes = baos.toByteArray();
// Do something with 'filename' and 'bytes' ...
// How do I save to sdcard?
}
} finally {
zis.close();
}
非常感谢您的帮助。
Thanks a lot for any help.
推荐答案
好答案已经贴吧的样子,只是如果你需要更多的帮助,问: 写一个文件到SD卡
Good answer already posted it looks like, if you need more help just ask: Writing a file to sdcard
这篇关于如何保存文件到SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文