Class ClassPath


  • public class ClassPath
    extends java.lang.Object
    This class is used to represent a class path, which can contain both directories and zip files. WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassPath​(java.lang.String pathstr)
      Build a class path from the specified path string
      ClassPath​(java.lang.String... patharray)
      Build a class path from the specified array of class path element strings.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Release resources.
      (package private) ClassFile getDirectory​(java.lang.String name)
      Find the specified directory in the class path
      ClassFile getFile​(java.lang.String name)
      Load the specified file from the class path
      private ClassFile getFile​(java.lang.String name, boolean isDirectory)  
      (package private) java.util.Enumeration<ClassFile> getFiles​(java.lang.String pkg, java.lang.String ext)
      Returns list of files given a package name and extension.
      private java.nio.file.FileSystem getJrtFileSystem()  
      private void init​(java.lang.String pathstr)  
      private void init​(java.lang.String[] patharray)  
      java.lang.String toString()
      Returns original class path string
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • dirSeparator

        private static final char dirSeparator
      • pathstr

        private java.lang.String pathstr
        The original class path string
      • fileSeparatorChar

        private final java.lang.String fileSeparatorChar
    • Constructor Detail

      • ClassPath

        ClassPath​(java.lang.String pathstr)
        Build a class path from the specified path string
      • ClassPath

        public ClassPath​(java.lang.String... patharray)
        Build a class path from the specified array of class path element strings. This constructor, and the corresponding "init" method, were added as part of the fix for 6473331, which adds support for Class-Path manifest entries in JAR files to rmic. It is conceivable that the value of a Class-Path manifest entry will contain a path separator, which would cause incorrect behavior if the expanded path were passed to the previous constructor as a single path-separator-delimited string; use of this constructor avoids that problem.
    • Method Detail

      • getJrtFileSystem

        private java.nio.file.FileSystem getJrtFileSystem()
      • init

        private void init​(java.lang.String pathstr)
      • init

        private void init​(java.lang.String[] patharray)
      • getDirectory

        ClassFile getDirectory​(java.lang.String name)
        Find the specified directory in the class path
      • getFile

        public ClassFile getFile​(java.lang.String name)
        Load the specified file from the class path
      • getFile

        private ClassFile getFile​(java.lang.String name,
                                  boolean isDirectory)
      • getFiles

        java.util.Enumeration<ClassFile> getFiles​(java.lang.String pkg,
                                                  java.lang.String ext)
        Returns list of files given a package name and extension.
      • close

        public void close()
                   throws java.io.IOException
        Release resources.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Returns original class path string
        Overrides:
        toString in class java.lang.Object