hudson.remoting.Which.classFileUrl()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中hudson.remoting.Which.classFileUrl()方法的一些代码示例,展示了Which.classFileUrl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Which.classFileUrl()方法的具体详情如下:
包路径:hudson.remoting.Which
类名称:Which
方法名:classFileUrl

Which.classFileUrl介绍

[英]Returns the URL of the class file where the given class has been loaded from.
[中]返回从中加载给定类的类文件的URL。

代码示例

代码示例来源:origin: org.eclipse.hudson/hudson-remoting

/**
 * @deprecated Use {@link #classFileUrl(Class)}
 */
public static URL jarURL(Class clazz) throws IOException {
  return classFileUrl(clazz);
}

代码示例来源:origin: jenkinsci/remoting

/**
 * @deprecated Use {@link #classFileUrl(Class)}
 */
@Deprecated
public static URL jarURL(Class clazz) throws IOException {
  return classFileUrl(clazz);
}

代码示例来源:origin: org.eclipse.hudson/hudson-remoting

/**
 * Locates the jar file that contains the given class.
 *
 * <p>
 * Note that jar files are not always loaded from {@link File},
 * so for diagnostics purposes {@link #jarURL(Class)} is preferrable.
 *
 * @throws IllegalArgumentException
 *      if failed to determine.
 */
public static File jarFile(Class clazz) throws IOException {
  return jarFile(classFileUrl(clazz),clazz.getName().replace('.','/')+".class");
}

代码示例来源:origin: jenkinsci/remoting

/**
 * Locates the jar file that contains the given class.
 *
 * <p>
 * Note that jar files are not always loaded from {@link File},
 * so for diagnostics purposes {@link #jarURL(Class)} is preferrable.
 *
 * @param clazz Class
 * @throws IllegalArgumentException
 *      if failed to determine the class File URL.
 * @return
 *      JAR File, which contains the class.
 */
@Nonnull
public static File jarFile(Class clazz) throws IOException {
  return jarFile(classFileUrl(clazz),clazz.getName().replace('.','/')+".class");
}

代码示例来源:origin: jenkinsci/remoting

public Object apply(Object o) {
    try {
      // verify that 'o' is loaded from a jar file
      String loc = Which.classFileUrl(o.getClass()).toExternalForm();
      System.out.println(loc);
      assertTrue(loc, loc.startsWith("jar:"));
      return null;
    } catch (IOException e) {
      throw new Error(e);
    }
  }
}

代码示例来源:origin: jenkinsci/remoting

final URL urlOfClassFile = Which.classFileUrl(c);

相关文章