非常感谢 Yishai ......这是我一直在等待的提示 :) 可能有人在那里,谁需要做同样的事情,因此......这是我的代码:
public static boolean copyApkFile(File outputFile){
try {
FileInputStream fis = new FileInputStream(this.getClass().getResource("/resources/myApkFile.apk").getFile());
ZipInputStream zis = new ZipInputStream(fis);
FileOutputStream fos = new FileOutputStream(outputFile));
ZipOutputStream zos = new ZipOutputStream(fos);
ZipEntry ze = null;
byte[] buf = new byte[1024];
while ((ze = zis.getNextEntry()) != null) {
System.out.println("Next entry "+ze.getName()+" "+ze.getSize());
zos.putNextEntry(ze);
int len;
while ((len = zis.read(buf)) > 0) {
zos.write(buf, 0, len);
}
}
zos.close();
fos.close();
zis.close();
fis.close();
return true;
} catch (IOException ex) {
Logger.getLogger(SetUpNewDevice.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}