251 252 public boolean hasNext() { 253 return e.hasMoreElements(); 254 } 255 256 public JarEntry next() { 257 ZipEntry ze = e.nextElement(); 258 return new JarFileEntry(ze); 259 } 260 261 public boolean hasMoreElements() { 262 return hasNext(); 263 } 264 265 public JarEntry nextElement() { 266 return next(); 267 } 268 } 269 270 /** 271 * Returns an enumeration of the zip file entries. 272 */ 273 public Enumeration<JarEntry> entries() { 274 return new JarEntryIterator(); 275 } 276 277 @Override 278 public Stream<JarEntry> stream() { 279 return StreamSupport.stream(Spliterators.spliterator( 280 new JarEntryIterator(), size(), 281 Spliterator.ORDERED | Spliterator.DISTINCT | 282 Spliterator.IMMUTABLE | Spliterator.NONNULL), false); 283 } 284 285 private class JarFileEntry extends JarEntry { 286 JarFileEntry(ZipEntry ze) { 287 super(ze); 288 } 289 public Attributes getAttributes() throws IOException { 290 Manifest man = JarFile.this.getManifest(); 291 if (man != null) { 292 return man.getAttributes(getName()); 293 } else { 294 return null; 295 } 296 } 297 public Certificate[] getCertificates() { | 251 252 public boolean hasNext() { 253 return e.hasMoreElements(); 254 } 255 256 public JarEntry next() { 257 ZipEntry ze = e.nextElement(); 258 return new JarFileEntry(ze); 259 } 260 261 public boolean hasMoreElements() { 262 return hasNext(); 263 } 264 265 public JarEntry nextElement() { 266 return next(); 267 } 268 } 269 270 /** 271 * Returns an enumeration of the jar file entries. 272 * 273 * @return an enumeration of the jar file entries 274 * @throws IllegalStateException 275 * may be thrown if the jar file has been closed 276 */ 277 public Enumeration<JarEntry> entries() { 278 return new JarEntryIterator(); 279 } 280 281 /** 282 * Returns an ordered {@code Stream} over the jar file entries. 283 * Entries appear in the {@code Stream} in the order they appear in 284 * the central directory of the jar file. 285 * 286 * @return an ordered {@code Stream} of entries in this jar file 287 * @throws IllegalStateException if the jar file has been closed 288 * @since 1.8 289 */ 290 public Stream<JarEntry> stream() { 291 return StreamSupport.stream(Spliterators.spliterator( 292 new JarEntryIterator(), size(), 293 Spliterator.ORDERED | Spliterator.DISTINCT | 294 Spliterator.IMMUTABLE | Spliterator.NONNULL), false); 295 } 296 297 private class JarFileEntry extends JarEntry { 298 JarFileEntry(ZipEntry ze) { 299 super(ze); 300 } 301 public Attributes getAttributes() throws IOException { 302 Manifest man = JarFile.this.getManifest(); 303 if (man != null) { 304 return man.getAttributes(getName()); 305 } else { 306 return null; 307 } 308 } 309 public Certificate[] getCertificates() { |