,我使用此代码为null while(!= null)部分,zin.getNextEntry()始终为空,因此它不会提取任何东西。
.zip文件是150kb ..我该如何解决这个问题?ZipInputStream getNextEntry解压时的.zip我试图提取.zip文件的文件
该.zip存在我使用中的DL的.zip
代码:
URL=intent.getStringExtra("DownloadService_URL");
FileName=intent.getStringExtra("DownloadService_FILENAME");
Path=intent.getStringExtra("DownloadService_PATH");
File PathChecker = new File(Path);
try{
if(!PathChecker.isDirectory())
PathChecker.mkdirs();
URL url = new URL(URL);
URLConnection conexion = url.openConnection();
conexion.connect();
int lenghtOfFile = conexion.getContentLength();
lenghtOfFile/=100;
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream(Path+FileName);
byte data[] = new byte[1024];
long total = 0;
int count = 0;
while ((count = input.read(data)) != -1) {
output.write(data, 0, count);
total += count;
notification.setLatestEventInfo(context, contentTitle, "جاري تحميل ملف " + FileName + " " + (total/lenghtOfFile), contentIntent);
mNotificationManager.notify(1, notification);
}
output.flush();
output.close();
input.close();
听起来像是'zipFile'可能不存在。仔细检查'Path'和'FileName'以确保它们是正确的。 – bamana
@bamana完全不可能使用该代码,它会在新的FileInputStream中抛出IOException。 – EJP
请在发布到公共论坛的源代码中使用camelCase作为属性名称。 –