当前位置: 首页>>代码示例>>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;未经允许,请勿转载。