APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.jdeps

public Class ClassFileReader

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.sun.tools.jdeps.ClassFileReader.DirectoryReader, com.sun.tools.jdeps.ClassFileReader.JarFileReader
Imports
com.sun.tools.jdeps.Dependencies.ClassFileError, java.io.Closeable, .File, .FileNotFoundException, .IOException, .InputStream, .UncheckedIOException, java.lang.classfile.ClassFile, .ClassModel, java.nio.file.FileSystem, .FileSystems, .Files, .Path, java.util.ArrayList, .Collections, .List, .Set, java.util.function.Consumer, java.util.jar.JarEntry, .JarFile, java.util.stream.Collectors, .Stream, java.util.zip.ZipFile

ClassFileReader reads ClassModel(s) of a given path that can be a .class file, a directory, or a JAR file.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
protected final String
protected Set<String>
protected final Path
protected final List<String>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public Set<String>
entries()

Returns all entries in this archive.

public void
public ClassModel
getClassFile(String name)

Returns the ClassModel matching the given binary name or a fully-qualified class name.

public String
pack-priv static boolean
isClass(Path file)

public static ClassFileReader
newInstance(Path path, Runtime.Version version)

Returns a ClassFileReader instance of a given path.

public static ClassFileReader
newInstance(FileSystem fs, Path path)

Returns a ClassFileReader instance of a given FileSystem and path.

protected ClassModel
protected Set<String>
scan()

protected void
skipEntry(Throwable ex, String entryPath)

public List<String>
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

baseFileNameback to summary
protected final String baseFileName
entriesback to summary
protected Set<String> entries
pathback to summary
protected final Path path
skippedEntriesback to summary
protected final List<String> skippedEntries

Constructor Detail

ClassFileReaderback to summary
protected ClassFileReader(Path path)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
entriesback to summary
public Set<String> entries()

Returns all entries in this archive.

forEachClassFileback to summary
public void forEachClassFile(Consumer<ClassModel> handler) throws IOException
getClassFileback to summary
public ClassModel getClassFile(String name) throws IOException

Returns the ClassModel matching the given binary name or a fully-qualified class name.

getFileNameback to summary
public String getFileName()
isClassback to summary
pack-priv static boolean isClass(Path file)
newInstanceback to summary
public static ClassFileReader newInstance(Path path, Runtime.Version version) throws IOException

Returns a ClassFileReader instance of a given path.

newInstanceback to summary
public static ClassFileReader newInstance(FileSystem fs, Path path) throws IOException

Returns a ClassFileReader instance of a given FileSystem and path. This method is used for reading classes from jrtfs.

readClassFileback to summary
protected ClassModel readClassFile(Path p) throws IOException
scanback to summary
protected Set<String> scan()
skipEntryback to summary
protected void skipEntry(Throwable ex, String entryPath)
skippedEntriesback to summary
public List<String> skippedEntries()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

com.sun.tools.jdeps back to summary

private Class ClassFileReader.DirectoryReader

extends ClassFileReader
Class Inheritance

Field Summary

Modifier and TypeField and Description
protected final String
Inherited from com.sun.tools.jdeps.ClassFileReader:
baseFileNameentriespathskippedEntries

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public ClassModel
getClassFile(String name)

Overrides com.sun.tools.jdeps.ClassFileReader.getClassFile.

Returns the ClassModel matching the given binary name or a fully-qualified class name.

protected Set<String>
Inherited from com.sun.tools.jdeps.ClassFileReader:
closeentriesgetFileNameisClassnewInstancenewInstancereadClassFileskipEntryskippedEntriestoString

Field Detail

fsSepback to summary
protected final String fsSep

Constructor Detail

DirectoryReaderback to summary
pack-priv DirectoryReader(Path path) throws IOException
DirectoryReaderback to summary
pack-priv DirectoryReader(FileSystem fs, Path path) throws IOException

Method Detail

forEachClassFileback to summary
public void forEachClassFile(Consumer<ClassModel> handler) throws IOException

Overrides com.sun.tools.jdeps.ClassFileReader.forEachClassFile.

Annotations
@Override
getClassFileback to summary
public ClassModel getClassFile(String name) throws IOException

Overrides com.sun.tools.jdeps.ClassFileReader.getClassFile.

Doc from com.sun.tools.jdeps.ClassFileReader.getClassFile.

Returns the ClassModel matching the given binary name or a fully-qualified class name.

scanback to summary
protected Set<String> scan()

Overrides com.sun.tools.jdeps.ClassFileReader.scan.

com.sun.tools.jdeps back to summary

pack-priv Class ClassFileReader.JarFileReader

extends ClassFileReader
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final JarFile
private final Runtime.Version
Inherited from com.sun.tools.jdeps.ClassFileReader:
baseFileNameentriespathskippedEntries

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides com.sun.tools.jdeps.ClassFileReader.close.

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public void
public ClassModel
getClassFile(String name)

Overrides com.sun.tools.jdeps.ClassFileReader.getClassFile.

Returns the ClassModel matching the given binary name or a fully-qualified class name.

private static boolean
private static JarFile
protected ClassModel
protected Set<String>
Inherited from com.sun.tools.jdeps.ClassFileReader:
entriesgetFileNameisClassnewInstancenewInstancereadClassFileskipEntryskippedEntriestoString

Field Detail

jarfileback to summary
private final JarFile jarfile
versionback to summary
private final Runtime.Version version

Constructor Detail

JarFileReaderback to summary
pack-priv JarFileReader(Path path, Runtime.Version version) throws IOException
JarFileReaderback to summary
pack-priv JarFileReader(Path path, JarFile jf, Runtime.Version version) throws IOException

Method Detail

closeback to summary
public void close() throws IOException

Overrides com.sun.tools.jdeps.ClassFileReader.close.

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
forEachClassFileback to summary
public void forEachClassFile(Consumer<ClassModel> handler) throws IOException

Overrides com.sun.tools.jdeps.ClassFileReader.forEachClassFile.

Annotations
@Override
getClassFileback to summary
public ClassModel getClassFile(String name) throws IOException

Overrides com.sun.tools.jdeps.ClassFileReader.getClassFile.

Doc from com.sun.tools.jdeps.ClassFileReader.getClassFile.

Returns the ClassModel matching the given binary name or a fully-qualified class name.

isJarEntryClassback to summary
private static boolean isJarEntryClass(JarEntry e)
openJarFileback to summary
private static JarFile openJarFile(File f, Runtime.Version version) throws IOException
readClassFileback to summary
protected ClassModel readClassFile(JarFile jarfile, JarEntry e) throws IOException
scanback to summary
protected Set<String> scan()

Overrides com.sun.tools.jdeps.ClassFileReader.scan.