Searches for a zip entry in this archive with the given name. @param name the name. May contain directory components separated by slashes ('/'). @return the zip entry, or null if no entry with that name exists. @exception IllegalStateException when the ZipFile has already been closed
(String name)
| 369 | * @exception IllegalStateException when the ZipFile has already been closed |
| 370 | */ |
| 371 | public ZipEntry getEntry(String name) |
| 372 | { |
| 373 | checkClosed(); |
| 374 | |
| 375 | try |
| 376 | { |
| 377 | Hashtable entries = getEntries(); |
| 378 | ZipEntry entry = (ZipEntry) entries.get(name); |
| 379 | // If we didn't find it, maybe it's a directory. |
| 380 | if (entry == null && !name.endsWith("/")) |
| 381 | entry = (ZipEntry) entries.get(name + '/'); |
| 382 | return entry != null ? new ZipEntry(entry, name) : null; |
| 383 | } |
| 384 | catch (IOException ioe) |
| 385 | { |
| 386 | return null; |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Creates an input stream reading the given zip entry as |
nothing calls this directly
no test coverage detected