Closes the current zip entry and moves to the next one.
()
| 224 | * Closes the current zip entry and moves to the next one. |
| 225 | */ |
| 226 | public void closeEntry() throws IOException |
| 227 | { |
| 228 | if (crc == null) |
| 229 | throw new IOException("Stream closed."); |
| 230 | if (entry == null) |
| 231 | return; |
| 232 | |
| 233 | if (method == ZipEntry.DEFLATED) |
| 234 | { |
| 235 | if ((flags & 8) != 0) |
| 236 | { |
| 237 | /* We don't know how much we must skip, read until end. */ |
| 238 | byte[] tmp = new byte[2048]; |
| 239 | while (read(tmp) > 0) |
| 240 | ; |
| 241 | |
| 242 | /* read will close this entry */ |
| 243 | return; |
| 244 | } |
| 245 | csize -= inf.getTotalIn(); |
| 246 | avail = inf.getRemaining(); |
| 247 | } |
| 248 | |
| 249 | if (avail > csize && csize >= 0) |
| 250 | avail -= csize; |
| 251 | else |
| 252 | { |
| 253 | csize -= avail; |
| 254 | avail = 0; |
| 255 | while (csize != 0) |
| 256 | { |
| 257 | long skipped = in.skip(csize & 0xffffffffL); |
| 258 | if (skipped <= 0) |
| 259 | throw new ZipException("zip archive ends early."); |
| 260 | csize -= skipped; |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | size = 0; |
| 265 | crc.reset(); |
| 266 | if (method == ZipEntry.DEFLATED) |
| 267 | inf.reset(); |
| 268 | entry = null; |
| 269 | entryAtEOF = true; |
| 270 | } |
| 271 | |
| 272 | public int available() throws IOException |
| 273 | { |
no test coverage detected