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

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

本文整理了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

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

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

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

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

  1. /**
  2. * Extracts a resource using the {@link ClassLoader} of the caller class,
  3. * and returns the cached {@link File}.
  4. *
  5. * @param name the name of the resource passed to {@link Class#getResource(String)}
  6. * @see #cacheResource(Class, String)
  7. */
  8. public static File cacheResource(String name) throws IOException {
  9. Class cls = getCallerClass(2);
  10. return cacheResource(cls, name);
  11. }
  12. /**

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

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

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

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

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

  1. /**
  2. * Loads native libraries associated with the {@link Class} of the caller.
  3. *
  4. * @param pathsFirst search the paths first before bundled resources
  5. * @return {@code load(getCallerClass(2), loadProperties(), pathsFirst) }
  6. * @see #getCallerClass(int)
  7. * @see #load(Class, Properties, boolean)
  8. */
  9. public static String load(boolean pathsFirst) {
  10. Class cls = getCallerClass(2);
  11. return load(cls, loadProperties(), pathsFirst);
  12. }
  13. /** Returns {@code load(cls, loadProperties(), Loader.pathsFirst)}. */

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

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

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

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

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

  1. public CLKernel[] buildKernels(String compilerOptions, Class resourceClass, String resourceNames, String ... kernelNames) {
  2. try {
  3. //load and compile program for the chosen device
  4. InputStream s;
  5. String[] a = resourceNames.split(":");
  6. if (a.length == 1) {
  7. s = resourceClass.getResourceAsStream(a[0]);
  8. } else {
  9. Vector<InputStream> vs = new Vector<InputStream>(a.length);
  10. for (String name : a) {
  11. vs.addElement(resourceClass.getResourceAsStream(name));
  12. }
  13. s = new SequenceInputStream(vs.elements());
  14. }
  15. CLProgram program = context.createProgram(s);
  16. //System.out.println("Building " + resourceNames + "...");
  17. program.build(compilerOptions);
  18. //System.out.println(program.getBuildLog());
  19. assert program.isExecutable();
  20. // create kernel and set function parameters
  21. CLKernel[] kernels = new CLKernel[kernelNames.length];
  22. for (int i = 0; i < kernelNames.length; i++) {
  23. kernels[i] = program.createCLKernel(kernelNames[i]);
  24. }
  25. return kernels;
  26. } catch(IOException ex) {
  27. throw (Error)new LinkageError(ex.toString()).initCause(ex);
  28. }
  29. }

相关文章