Package org.apache.bcel.util
Class ClassPath
java.lang.Object
org.apache.bcel.util.ClassPath
- All Implemented Interfaces:
Closeable
,AutoCloseable
Responsible for loading (class) files from the CLASSPATH. Inspired by sun.tools.ClassPath.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Contains information about file/ZIP entry of the Java class. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
byte[]
byte[]
getClassFile
(String name) getClassFile
(String name, String suffix) static String
Checks for class path components in the following properties: "java.class.path", "sun.boot.class.path", "java.ext.dirs"getInputStream
(String name) getInputStream
(String name, String suffix) Return stream for class or resource on CLASSPATH.getResource
(String name) getResourceAsStream
(String name) getResources
(String name) int
hashCode()
toString()
-
Field Details
-
SYSTEM_CLASS_PATH
-
-
Constructor Details
-
ClassPath
Deprecated.Use SYSTEM_CLASS_PATH constantSearch for classes in CLASSPATH. -
ClassPath
-
ClassPath
Search for classes in given path.- Parameters:
classPath
-
-
-
Method Details
-
getClassPath
Checks for class path components in the following properties: "java.class.path", "sun.boot.class.path", "java.ext.dirs"- Returns:
- class path as used by default by BCEL
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
equals
-
getBytes
- Returns:
- byte array for class
- Throws:
IOException
-
getBytes
- Parameters:
name
- fully qualified file name, e.g. java/lang/Stringsuffix
- file name ends with suffix, e.g. .java- Returns:
- byte array for file on class path
- Throws:
IOException
-
getClassFile
- Parameters:
name
- fully qualified class name, e.g. java.lang.String- Returns:
- input stream for class
- Throws:
IOException
-
getClassFile
- Parameters:
name
- fully qualified file name, e.g. java/lang/Stringsuffix
- file name ends with suff, e.g. .java- Returns:
- class file for the java class
- Throws:
IOException
-
getInputStream
- Parameters:
name
- fully qualified class name, e.g. java.lang.String- Returns:
- input stream for class
- Throws:
IOException
-
getInputStream
Return stream for class or resource on CLASSPATH.- Parameters:
name
- fully qualified file name, e.g. java/lang/Stringsuffix
- file name ends with suff, e.g. .java- Returns:
- input stream for file on class path
- Throws:
IOException
-
getPath
- Parameters:
name
- name of file to search for, e.g. java/lang/String.java- Returns:
- full (canonical) path for file
- Throws:
IOException
-
getPath
- Parameters:
name
- name of file to search for, e.g. java/lang/Stringsuffix
- file name suffix, e.g. .java- Returns:
- full (canonical) path for file, if it exists
- Throws:
IOException
-
getResource
- Parameters:
name
- fully qualified resource name, e.g. java/lang/String.class- Returns:
- URL supplying the resource, or null if no resource with that name.
- Since:
- 6.0
-
getResourceAsStream
- Parameters:
name
- fully qualified resource name, e.g. java/lang/String.class- Returns:
- InputStream supplying the resource, or null if no resource with that name.
- Since:
- 6.0
-
getResources
- Parameters:
name
- fully qualified resource name, e.g. java/lang/String.class- Returns:
- An Enumeration of URLs supplying the resource, or an empty Enumeration if no resource with that name.
- Since:
- 6.0
-
hashCode
public int hashCode() -
toString
-