我是
android和
java编程的新手,有人可以告诉我如何保存文件,我有以下代码:
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,count); } String filename = ze.getName(); byte[] bytes = baos.toByteArray(); // Do something with 'filename' and 'bytes' ... // How do I save to sdcard? } } finally { zis.close(); }
非常感谢您的帮助.
解决方法
如果您需要更多帮助,只需询问:
Writing a file to sdcard
Writing a file to sdcard