org.bytedeco.javacpp.Loader.getCallerClass()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(154)

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

Loader.getCallerClass介绍

[英]Returns the Class object that contains a caller's method.
[中]返回包含调用方方法的类对象。

代码示例

代码示例来源:origin: bytedeco/javacpp

/**
 * Extracts resources using the {@link ClassLoader} of the caller class,
 * and returns the cached {@link File} objects.
 *
 * @param name of the resources passed to {@link #findResources(Class, String)}
 * @see #cacheResources(Class, String)
 */
public static File[] cacheResources(String name) throws IOException {
  Class cls = getCallerClass(2);
  return cacheResources(cls, name);
}
/**

代码示例来源:origin: bytedeco/javacpp

/**
 * Extracts by name resources using the {@link ClassLoader} of the caller.
 *
 * @param name of the resources passed to {@link #findResources(Class, String)}
 * @see #extractResources(Class, String, File, String, String)
 */
public static File[] extractResources(String name, File directory,
    String prefix, String suffix) throws IOException {
  Class cls = getCallerClass(2);
  return extractResources(cls, name, directory, prefix, suffix);
}
/**

代码示例来源:origin: bytedeco/javacpp

/**
 * Extracts a resource using the {@link ClassLoader} of the caller class,
 * and returns the cached {@link File}.
 *
 * @param name the name of the resource passed to {@link Class#getResource(String)}
 * @see #cacheResource(Class, String)
 */
public static File cacheResource(String name) throws IOException {
  Class cls = getCallerClass(2);
  return cacheResource(cls, name);
}
/**

代码示例来源:origin: bytedeco/javacpp

/**
 * Extracts by name a resource using the {@link ClassLoader} of the caller.
 *
 * @param name the name of the resource passed to {@link Class#getResource(String)}
 * @see #extractResource(URL, File, String, String)
 */
public static File extractResource(String name, File directory,
    String prefix, String suffix) throws IOException {
  Class cls = getCallerClass(2);
  return extractResource(cls, name, directory, prefix, suffix);
}
/**

代码示例来源:origin: bytedeco/javacpp

/** Returns {@code load(getCallerClass(2), loadProperties(), Loader.pathsFirst)}. */
public static String load() {
  return load(getCallerClass(2), loadProperties(), Loader.pathsFirst);
}
/**

代码示例来源:origin: bytedeco/javacpp

/**
 * Loads native libraries associated with the {@link Class} of the caller.
 *
 * @param pathsFirst search the paths first before bundled resources
 * @return {@code load(getCallerClass(2), loadProperties(), pathsFirst) }
 * @see #getCallerClass(int)
 * @see #load(Class, Properties, boolean)
 */
public static String load(boolean pathsFirst) {
  Class cls = getCallerClass(2);
  return load(cls, loadProperties(), pathsFirst);
}
/** Returns {@code load(cls, loadProperties(), Loader.pathsFirst)}. */

代码示例来源:origin: org.bytedeco/javacv

public CLKernel buildKernel(String resourceNames, String kernelName) {
  return buildKernels(fastCompilerOptions, Loader.getCallerClass(2), resourceNames, kernelName)[0];
}
public CLKernel buildKernel(String compilerOptions, String resourceNames, String kernelName) {

代码示例来源:origin: org.bytedeco/javacv

public CLKernel buildKernel(String compilerOptions, String resourceNames, String kernelName) {
  return buildKernels(compilerOptions, Loader.getCallerClass(2), resourceNames, kernelName)[0];
}

代码示例来源:origin: org.bytedeco/javacv

public CLKernel[] buildKernels(String compilerOptions, Class resourceClass, String resourceNames, String ... kernelNames) {
    try {
      //load and compile program for the chosen device
      InputStream s;
      String[] a = resourceNames.split(":");
      if (a.length == 1) {
        s = resourceClass.getResourceAsStream(a[0]);
      } else {
        Vector<InputStream> vs = new Vector<InputStream>(a.length);
        for (String name : a) {
          vs.addElement(resourceClass.getResourceAsStream(name));
        }
        s = new SequenceInputStream(vs.elements());
      }
      CLProgram program = context.createProgram(s);
//System.out.println("Building " + resourceNames + "...");
      program.build(compilerOptions);
//System.out.println(program.getBuildLog());
      assert program.isExecutable();

      // create kernel and set function parameters
      CLKernel[] kernels = new CLKernel[kernelNames.length];
      for (int i = 0; i < kernelNames.length; i++) {
        kernels[i] = program.createCLKernel(kernelNames[i]);
      }
      return kernels;
    } catch(IOException ex) {
      throw (Error)new LinkageError(ex.toString()).initCause(ex);
    }
  }

相关文章