Home > Mobile >  ZipInputStream. GetNextEntry () is null
ZipInputStream. GetNextEntry () is null

Time:10-04

. This is my code, zipInputStream getNextEntry () is null in android why do eclipse can be in the studio, distress
 public static void unZip (Context Context, String assetName, 
String outputDirectory, Boolean isReWrite) throws IOException {
The File File=new File (outputDirectory);
if (! File. The exists ()) {
File. The file.mkdirs ();
}
InputStream InputStream=context. GetClass (). GetClassLoader () getResourceAsStream (" assets/" + assetName);
Int I=inputStream. Read ();
ZipInputStream ZipInputStream=new ZipInputStream (inputStream);
ZipEntry ZipEntry=zipInputStream. GetNextEntry ();
Byte [] buffer=new byte (1024 * 1024),
int count=0;
While (zipEntry!=null) {
{if (zipEntry. IsDirectory ())
The file=new file (outputDirectory + file. The separator + zipEntry. GetName ());
If (isReWrite | |! File. The exists ()) {
File. The mkdir ();
}
} else {
The file=new file (outputDirectory + file. The separator
+ zipEntry. GetName ());
If (isReWrite | |! File. The exists ()) {
file.createNewFile();
FileOutputStream FileOutputStream=new FileOutputStream (file);
While ((count=zipInputStream. Read (buffer)) & gt; 0 {
FileOutputStream. Write (buffer, 0, count);
}
FileOutputStream. Close ();
}
}
ZipEntry=zipInputStream. GetNextEntry ();
}
ZipInputStream. Close ();
}

CodePudding user response:

I also am getnextentry () has been to null
  • Related