Как удалить zip-файл в java?Метод file.delete возвращает false.Почему?
File file = new File("/mibook/"+mFilename+"/"+mZipname.toString());
boolean deleted = file.delete();
edit:
Правило "Директория должна быть очищена до удаления .." применимо к zip-файлу?
Код разархивирования моего файла
public void unzip() throws IOException {
FileInputStream fin=null;
ZipInputStream zin=null;
File file =null;
ZipEntry ze ;
FileOutputStream fout=null;
try{
System.out.println(_zipFile );
System.out.println(_location);
fin = new FileInputStream(_zipFile);
zin = new ZipInputStream(fin);
ze= null;
byte[] buffer = new byte[1024];
int length;
while ((ze = zin.getNextEntry()) != null) {
file = new File((_location +"/" + ze.getName()));
file.getParentFile().mkdirs();
fout= new FileOutputStream(_location + ze.getName());
while ((length = zin.read(buffer))>0) {
fout.write(buffer, 0, length);
}
zin.closeEntry();
fout.close();<br>
}
zin.close();
}catch(Exception e) {
Log.e("Decompress", "unzip", e);
}<br>
finally {</p>
<pre><code> fin.close();
zin.close();
fout.close();
}
}