< prev index next >

src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java

Print this page

        

*** 28,39 **** import com.sun.tools.classfile.AccessFlags; import com.sun.tools.classfile.ClassFile; import com.sun.tools.classfile.ConstantPoolException; import com.sun.tools.classfile.Dependencies.ClassFileError; - import jdk.internal.util.jar.VersionedStream; - import java.io.Closeable; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; --- 28,37 ----
*** 334,344 **** return jf; } protected Set<String> scan() { try (JarFile jf = openJarFile(path.toFile(), version)) { ! return VersionedStream.stream(jf).map(JarEntry::getName) .filter(n -> n.endsWith(".class")) .collect(Collectors.toSet()); } catch (IOException e) { throw new UncheckedIOException(e); } --- 332,342 ---- return jf; } protected Set<String> scan() { try (JarFile jf = openJarFile(path.toFile(), version)) { ! return jf.versionedStream().map(JarEntry::getName) .filter(n -> n.endsWith(".class")) .collect(Collectors.toSet()); } catch (IOException e) { throw new UncheckedIOException(e); }
*** 381,408 **** final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile); return () -> iter; } } - Enumeration<JarEntry> versionedEntries(JarFile jf) { - Iterator<JarEntry> it = VersionedStream.stream(jf).iterator(); - return new Enumeration<>() { - @Override - public boolean hasMoreElements() { - return it.hasNext(); - } - - @Override - public JarEntry nextElement() { - return it.next(); - } - }; - } - class JarFileIterator implements Iterator<ClassFile> { protected final JarFileReader reader; ! protected Enumeration<JarEntry> entries; protected JarFile jf; protected JarEntry nextEntry; protected ClassFile cf; JarFileIterator(JarFileReader reader) { this(reader, null); --- 379,391 ---- final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile); return () -> iter; } } class JarFileIterator implements Iterator<ClassFile> { protected final JarFileReader reader; ! protected Iterator<JarEntry> entries; protected JarFile jf; protected JarEntry nextEntry; protected ClassFile cf; JarFileIterator(JarFileReader reader) { this(reader, null);
*** 414,424 **** void setJarFile(JarFile jarfile) { if (jarfile == null) return; this.jf = jarfile; ! this.entries = versionedEntries(jf); this.nextEntry = nextEntry(); } public boolean hasNext() { if (nextEntry != null && cf != null) { --- 397,407 ---- void setJarFile(JarFile jarfile) { if (jarfile == null) return; this.jf = jarfile; ! this.entries = jarfile.versionedStream().iterator(); this.nextEntry = nextEntry(); } public boolean hasNext() { if (nextEntry != null && cf != null) {
*** 448,459 **** nextEntry = nextEntry(); return classFile; } protected JarEntry nextEntry() { ! while (entries.hasMoreElements()) { ! JarEntry e = entries.nextElement(); String name = e.getName(); if (name.endsWith(".class")) { return e; } } --- 431,442 ---- nextEntry = nextEntry(); return classFile; } protected JarEntry nextEntry() { ! while (entries.hasNext()) { ! JarEntry e = entries.next(); String name = e.getName(); if (name.endsWith(".class")) { return e; } }
< prev index next >