To demonstrate the problem I have at the moment, consider this simple code. continue loop; discontinues and skips that iteration.
loop: for(int i= 0 ; i < 5; i++){
if(i==2){
continue loop;
}
System.out.print(i);
}
will print
0134
For code below, area of interest -: loop: for ( ... ), continue. and the print code Log.v(...)
Basically, if "_rels/.rels" is found that loop should exclude the rest of that iteration and "i" should NOT be 0 at "after" print. But strangely, as the output shows, this didn't happen - the loop did not skip, why?
What code do I add to make sure when the String "_rels/.rels" is found the iteration jumps to the next? (not break; as i'm not looking to break out of the loop, I just need to skip that iteration and go to the next). Many Thanks
public void unzip() {
try {
FileInputStream fin = new FileInputStream(_zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
loop:for ( int i=0 ;(ze = zin.getNextEntry()) != null ; i++ ) {
Log.v(offset, "Unzipping before continue " + i + " "+ ze.getName());
if( ze.getName() == "_rels/.rels" ) continue loop;
Log.v(offset, "Unzipping after continue " + i + " "+ ze.getName());
if(ze.isDirectory()) {
_dirChecker(ze.getName());
} else {
FileOutputStream fout = new FileOutputStream(_location + ze.getName());
for (int c = zin.read(); c != -1; c = zin.read()) {
fout.write(c);
}
zin.closeEntry();
fout.close();
}
}
zin.close();
} catch(Exception e) {
Log.e(offset, "unzip", e);
}
}
output
11-27 04:06:21.073: V/offset(16671): Unzipping before continue 0 _rels/.rels
11-27 04:06:21.073: V/offset(16671): Unzipping after continue 0 _rels/.rels