當前位置: 首頁>>代碼示例>>Java>>正文


Java URLClassPath類代碼示例

本文整理匯總了Java中jdk.internal.loader.URLClassPath的典型用法代碼示例。如果您正苦於以下問題:Java URLClassPath類的具體用法?Java URLClassPath怎麽用?Java URLClassPath使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


URLClassPath類屬於jdk.internal.loader包,在下文中一共展示了URLClassPath類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: URLClassLoader

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
URLClassLoader(String name, URL[] urls, ClassLoader parent,
               AccessControlContext acc) {
    super(name, parent);
    // this is to make the stack depth consistent with 1.1
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkCreateClassLoader();
    }
    this.acc = acc;
    this.ucp = new URLClassPath(urls, acc);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:URLClassLoader.java

示例2: findResource

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
/**
 * Finds the resource with the specified name on the URL search path.
 *
 * @param name the name of the resource
 * @return a {@code URL} for the resource, or {@code null}
 * if the resource could not be found, or if the loader is closed.
 */
public URL findResource(final String name) {
    /*
     * The same restriction to finding classes applies to resources
     */
    URL url = AccessController.doPrivileged(
        new PrivilegedAction<>() {
            public URL run() {
                return ucp.findResource(name, true);
            }
        }, acc);

    return url != null ? URLClassPath.checkURL(url) : null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:URLClassLoader.java

示例3: findResource

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
/**
 * Finds a resource in a module, returning {@code null} if the resource
 * is not found.
 */
private static Resource findResource(String module, String name) {
    if (reader != null) {
        URL url = toJrtURL(module, name);
        ImageLocation location = reader.findLocation(module, name);
        if (location != null && URLClassPath.checkURL(url) != null) {
            return new Resource() {
                @Override
                public String getName() {
                    return name;
                }
                @Override
                public URL getURL() {
                    return url;
                }
                @Override
                public URL getCodeSourceURL() {
                    return toJrtURL(module);
                }
                @Override
                public InputStream getInputStream() throws IOException {
                    byte[] resource = reader.getResource(location);
                    return new ByteArrayInputStream(resource);
                }
                @Override
                public int getContentLength() {
                    long size = location.getUncompressedSize();
                    return (size > Integer.MAX_VALUE) ? -1 : (int) size;
                }
            };
        }
    }
    return null;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:38,代碼來源:JavaRuntimeURLConnection.java

示例4: URLClassLoader

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
URLClassLoader(URL[] urls, ClassLoader parent,
               AccessControlContext acc) {
    super(parent);
    // this is to make the stack depth consistent with 1.1
    SecurityManager security = System.getSecurityManager();
    if (security != null) {
        security.checkCreateClassLoader();
    }
    ucp = new URLClassPath(urls);
    this.acc = acc;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:12,代碼來源:URLClassLoader.java

示例5: getURLClassPath

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
public URLClassPath getURLClassPath(URLClassLoader u) {
    return u.ucp;
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:4,代碼來源:URLClassLoader.java

示例6: getURLClassPath

import jdk.internal.loader.URLClassPath; //導入依賴的package包/類
/**
 * return the URLClassPath belonging to the given loader
 */
URLClassPath getURLClassPath (URLClassLoader u);
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:5,代碼來源:JavaNetAccess.java


注:本文中的jdk.internal.loader.URLClassPath類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。