|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -191,20 +191,7 @@ public Manifest getManifest() throws IOException {
|
191 | 191 |
|
192 | 192 | @Override
|
193 | 193 | public Enumeration<java.util.jar.JarEntry> entries() {
|
194 |
| - final Iterator<JarEntry> iterator = this.entries.iterator(); |
195 |
| - return new Enumeration<java.util.jar.JarEntry>() { |
196 |
| - |
197 |
| - @Override |
198 |
| - public boolean hasMoreElements() { |
199 |
| - return iterator.hasNext(); |
200 |
| - } |
201 |
| - |
202 |
| - @Override |
203 |
| - public java.util.jar.JarEntry nextElement() { |
204 |
| - return iterator.next(); |
205 |
| - } |
206 |
| - |
207 |
| - }; |
| 194 | + return new JarEntryEnumeration(this.entries.iterator()); |
208 | 195 | }
|
209 | 196 |
|
210 | 197 | public JarEntry getJarEntry(CharSequence name) {
|
@@ -421,4 +408,27 @@ enum JarFileType {
|
421 | 408 |
|
422 | 409 | }
|
423 | 410 |
|
| 411 | + /** |
| 412 | + * An {@link Enumeration} on {@linkplain java.util.jar.JarEntry jar entries}. |
| 413 | + */ |
| 414 | + private static class JarEntryEnumeration implements Enumeration<java.util.jar.JarEntry> { |
| 415 | + |
| 416 | + private final Iterator<JarEntry> iterator; |
| 417 | + |
| 418 | + JarEntryEnumeration(Iterator<JarEntry> iterator) { |
| 419 | + this.iterator = iterator; |
| 420 | + } |
| 421 | + |
| 422 | + @Override |
| 423 | + public boolean hasMoreElements() { |
| 424 | + return this.iterator.hasNext(); |
| 425 | + } |
| 426 | + |
| 427 | + @Override |
| 428 | + public java.util.jar.JarEntry nextElement() { |
| 429 | + return this.iterator.next(); |
| 430 | + } |
| 431 | + |
| 432 | + } |
| 433 | + |
424 | 434 | }
|
0 commit comments