我有点新的Android和Java编程,可有人告诉我如何保存这些文件,我有以下代码:如何保存文件到SD卡
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();
}
非常感谢您的帮助。
[中写入一个文件到SD卡]的可能重复(http://stackoverflow.com/questions/2455102/writing-a-file-to-sdcard) – jww