Top Description Inners Fields Constructors Methods
org.aspectj.apache.bcel.util

public Class ClassPath

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.ByteArrayInputStream, .DataInputStream, .File, .FileInputStream, .FilenameFilter, .IOException, .InputStream, .Serializable, java.net.URI, java.nio.file.FileSystems, .FileVisitResult, .Files, .Path, .SimpleFileVisitor, java.nio.file.attribute.BasicFileAttributeView, .BasicFileAttributes, java.util.ArrayList, .HashMap, .Iterator, .List, .Map, .StringTokenizer, java.util.zip.ZipEntry, .ZipFile

Responsible for loading (class) files from the CLASSPATH. Inspired by sun.tools.ClassPath.
Authors
M. Dahm, Mario Ivankovits, Andy Clement

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ClassPath.ClassFile

Contains information about file/ZIP entry of the Java class.

private static class
private static class
private abstract static class
private static class

Field Summary

Modifier and TypeField and Description
private String
private static final String
private ClassPath.PathEntry[]
private static ClassPath

Constructor Summary

AccessConstructor and Description
public
ClassPath(String class_path)

Search for classes in given path.

public
ClassPath()

Deprecated Use SYSTEM_CLASS_PATH constant
Search for classes in CLASSPATH.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public byte[]

Returns:

byte array for file on class path
getBytes
(String
fully qualified file name, e.g. java/lang/String
name
,
String
file name ends with suffix, e.g. .java
suffix
)

public byte[]

Returns:

byte array for class
getBytes
(String name)

public ClassPath.ClassFile

Returns:

class file for the java class
getClassFile
(String
fully qualified file name, e.g. java/lang/String
name
,
String
file name ends with suff, e.g. .java
suffix
)

public ClassPath.ClassFile

Returns:

input stream for class
getClassFile
(String
fully qualified class name, e.g. java.lang.String
name
)

public static final String

Returns:

class path as used by default by BCEL
getClassPath
()

Checks for class path components in the following properties: "java.class.path", "sun.boot.class.path", "java.ext.dirs"

public InputStream

Returns:

input stream for class
getInputStream
(String
fully qualified class name, e.g. java.lang.String
name
)

public InputStream

Returns:

input stream for file on class path
getInputStream
(String
fully qualified file name, e.g. java/lang/String
name
,
String
file name ends with suff, e.g. .java
suffix
)

Return stream for class or resource on CLASSPATH.

public String

Returns:

full (canonical) path for file
getPath
(String
name of file to search for, e.g. java/lang/String.java
name
)

public String

Returns:

full (canonical) path for file, if it exists
getPath
(String
name of file to search for, e.g. java/lang/String
name
,
String
file name suffix, e.g. .java
suffix
)

private static final void
public static ClassPath
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public String

Returns:

used class path string
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

class_pathback to summary
private String class_path
JRT_FSback to summary
private static final String JRT_FS
pathsback to summary
private ClassPath.PathEntry[] paths
SYSTEM_CLASS_PATHback to summary
private static ClassPath SYSTEM_CLASS_PATH

Constructor Detail

ClassPathback to summary
public ClassPath(String class_path)

Search for classes in given path.

ClassPathback to summary
public ClassPath()

Deprecated

Use SYSTEM_CLASS_PATH constant

Search for classes in CLASSPATH.

Annotations
@Deprecated

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getBytesback to summary
public byte[] getBytes(String name, String suffix) throws IOException
Parameters
name:String

fully qualified file name, e.g. java/lang/String

suffix:String

file name ends with suffix, e.g. .java

Returns:byte[]

byte array for file on class path

getBytesback to summary
public byte[] getBytes(String name) throws IOException
Returns:byte[]

byte array for class

getClassFileback to summary
public ClassPath.ClassFile getClassFile(String name, String suffix) throws IOException
Parameters
name:String

fully qualified file name, e.g. java/lang/String

suffix:String

file name ends with suff, e.g. .java

Returns:ClassPath.ClassFile

class file for the java class

getClassFileback to summary
public ClassPath.ClassFile getClassFile(String name) throws IOException
Parameters
name:String

fully qualified class name, e.g. java.lang.String

Returns:ClassPath.ClassFile

input stream for class

getClassPathback to summary
public static final String getClassPath()

Checks for class path components in the following properties: "java.class.path", "sun.boot.class.path", "java.ext.dirs"

Returns:String

class path as used by default by BCEL

getInputStreamback to summary
public InputStream getInputStream(String name) throws IOException
Parameters
name:String

fully qualified class name, e.g. java.lang.String

Returns:InputStream

input stream for class

getInputStreamback to summary
public InputStream getInputStream(String name, String suffix) throws IOException

Return stream for class or resource on CLASSPATH.

Parameters
name:String

fully qualified file name, e.g. java/lang/String

suffix:String

file name ends with suff, e.g. .java

Returns:InputStream

input stream for file on class path

getPathback to summary
public String getPath(String name) throws IOException
Parameters
name:String

name of file to search for, e.g. java/lang/String.java

Returns:String

full (canonical) path for file

getPathback to summary
public String getPath(String name, String suffix) throws IOException
Parameters
name:String

name of file to search for, e.g. java/lang/String

suffix:String

file name suffix, e.g. .java

Returns:String

full (canonical) path for file, if it exists

getPathComponentsback to summary
private static final void getPathComponents(String path, List<String> list)
getSystemClassPathback to summary
public static ClassPath getSystemClassPath()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

used class path string

Annotations
@Override
org.aspectj.apache.bcel.util back to summary

public Interface ClassPath.ClassFile

Known Direct Implementers
org.aspectj.apache.bcel.util.ClassPath.JImage.ByteBasedClassFile

Contains information about file/ZIP entry of the Java class.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

base path of found class, i.e. class is contained relative to that path, which may either denote a directory, or zip file
getBase
()

public InputStream

Returns:

input stream for class file.
getInputStream
()

public String

Returns:

canonical path to class file.
getPath
()

public long

Returns:

size of class file.
getSize
()

public long

Returns:

modification time of class file.
getTime
()

Method Detail

getBaseback to summary
public String getBase()
Returns:String

base path of found class, i.e. class is contained relative to that path, which may either denote a directory, or zip file

getInputStreamback to summary
public InputStream getInputStream() throws IOException
Returns:InputStream

input stream for class file.

getPathback to summary
public String getPath()
Returns:String

canonical path to class file.

getSizeback to summary
public long getSize()
Returns:long

size of class file.

getTimeback to summary
public long getTime()
Returns:long

modification time of class file.

org.aspectj.apache.bcel.util back to summary

private Class ClassPath.Dir

extends PathEntry
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv ClassPath.ClassFile
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

dirback to summary
private String dir

Constructor Detail

Dirback to summary
pack-priv Dir(String d)

Method Detail

getClassFileback to summary
pack-priv ClassPath.ClassFile getClassFile(String name, String suffix) throws IOException

Implements abstract org.aspectj.apache.bcel.util.ClassPath.PathEntry.getClassFile.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.aspectj.apache.bcel.util back to summary

private Class ClassPath.JImage

extends PathEntry
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final Map<String, Path>
private FileSystem
private static String
private static URI
private static String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private Map<String, Path>
pack-priv ClassPath.ClassFile

Field Detail

fileMapback to summary
private final Map<String, Path> fileMap
fsback to summary
private FileSystem fs
JAVA_BASE_PATHback to summary
private static String JAVA_BASE_PATH
JRT_URIback to summary
private static URI JRT_URI
MODULES_PATHback to summary
private static String MODULES_PATH

Constructor Detail

JImageback to summary
pack-priv JImage()

Method Detail

buildFileMapback to summary
private Map<String, Path> buildFileMap()
getClassFileback to summary
pack-priv ClassPath.ClassFile getClassFile(String name, String suffix) throws IOException

Implements abstract org.aspectj.apache.bcel.util.ClassPath.PathEntry.getClassFile.

Annotations
@Override
org.aspectj.apache.bcel.util back to summary

private Class ClassPath.JImage.ByteBasedClassFile

extends Object
implements ClassFile
Class Inheritance
  • java.lang.Object
  • org.aspectj.apache.bcel.util.ClassPath.JImage.ByteBasedClassFile
All Implemented Interfaces
org.aspectj.apache.bcel.util.ClassPath.ClassFile

Field Summary

Modifier and TypeField and Description
private ByteArrayInputStream
private String
private byte[]
private String
private long
private long

Constructor Summary

AccessConstructor and Description
public
ByteBasedClassFile(byte[] bytes, String path, String base, long time, long size)

Field Detail

baisback to summary
private ByteArrayInputStream bais
baseback to summary
private String base
bytesback to summary
private byte[] bytes
pathback to summary
private String path
sizeback to summary
private long size
timeback to summary
private long time

Constructor Detail

ByteBasedClassFileback to summary
public ByteBasedClassFile(byte[] bytes, String path, String base, long time, long size)

Method Detail

getBaseback to summary
public String getBase()

Implements org.aspectj.apache.bcel.util.ClassPath.ClassFile.getBase.

Returns:String

Doc from org.aspectj.apache.bcel.util.ClassPath.ClassFile.getBase.

base path of found class, i.e. class is contained relative to that path, which may either denote a directory, or zip file

Annotations
@Override
getInputStreamback to summary
public InputStream getInputStream() throws IOException

Implements org.aspectj.apache.bcel.util.ClassPath.ClassFile.getInputStream.

Returns:InputStream

Doc from org.aspectj.apache.bcel.util.ClassPath.ClassFile.getInputStream.

input stream for class file.

Annotations
@Override
getPathback to summary
public String getPath()

Implements org.aspectj.apache.bcel.util.ClassPath.ClassFile.getPath.

Returns:String

Doc from org.aspectj.apache.bcel.util.ClassPath.ClassFile.getPath.

canonical path to class file.

Annotations
@Override
getSizeback to summary
public long getSize()

Implements org.aspectj.apache.bcel.util.ClassPath.ClassFile.getSize.

Returns:long

Doc from org.aspectj.apache.bcel.util.ClassPath.ClassFile.getSize.

size of class file.

Annotations
@Override
getTimeback to summary
public long getTime()

Implements org.aspectj.apache.bcel.util.ClassPath.ClassFile.getTime.

Returns:long

Doc from org.aspectj.apache.bcel.util.ClassPath.ClassFile.getTime.

modification time of class file.

Annotations
@Override
org.aspectj.apache.bcel.util back to summary

private abstract Class ClassPath.PathEntry

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.aspectj.apache.bcel.util.ClassPath.Dir, org.aspectj.apache.bcel.util.ClassPath.JImage, org.aspectj.apache.bcel.util.ClassPath.Zip

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract ClassPath.ClassFile
getClassFile(String name, String suffix)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PathEntryback to summary
private PathEntry()

Method Detail

getClassFileback to summary
pack-priv abstract ClassPath.ClassFile getClassFile(String name, String suffix) throws IOException
org.aspectj.apache.bcel.util back to summary

private Class ClassPath.Zip

extends PathEntry
Class Inheritance

Field Summary

Modifier and TypeField and Description
private ZipFile

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv ClassPath.ClassFile

Field Detail

zipback to summary
private ZipFile zip

Constructor Detail

Zipback to summary
pack-priv Zip(ZipFile z)

Method Detail

getClassFileback to summary
pack-priv ClassPath.ClassFile getClassFile(String name, String suffix) throws IOException

Implements abstract org.aspectj.apache.bcel.util.ClassPath.PathEntry.getClassFile.

Annotations
@Override