ZipInputStream getNextEntry est null lors de l'extraction .les fichiers zip

J'essaie de l'extraire .les fichiers zip et je suis en utilisant ce code:

String zipFile = Path + FileName;

FileInputStream fin = new FileInputStream(zipFile);
ZipInputStream zin = new ZipInputStream(fin);

ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
    UnzipCounter++;
    if (ze.isDirectory()) {
        dirChecker(ze.getName());
    } else {
        FileOutputStream fout = new FileOutputStream(Path
                + ze.getName());
        while ((Unziplength = zin.read(Unzipbuffer)) > 0) {
            fout.write(Unzipbuffer, 0, Unziplength);                    
        }
        zin.closeEntry();
        fout.close();

    }
}
zin.close();

mais le problème est que, pendant le débogage, lorsque le code atteint le while(!=null) partie, le zin.getNextEntry() est toujours nulle, de sorte qu'il ne marche pas extraire quoi que ce soit..

L' .le fichier zip est 150 ko.. Comment puis-je résoudre ce problème?

L' .zip existe

Code que j'utilise pour dl le .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();
Sonne comme zipFile peut ne pas exister. Vérifiez Path et FileName pour s'assurer qu'ils sont corrects.
complètement impossible avec ce code, il aurait jeté une IOException à new FileInputStream.
Veuillez utiliser camelCase pour les noms d'attribut dans la source posté dans les forums publics.

OriginalL'auteur Omar | 2011-09-26