Refine search
/** Returns {@code load(getCallerClass(2), loadProperties(), Loader.pathsFirst)}. */ public static String load() { return load(getCallerClass(2), loadProperties(), Loader.pathsFirst); } /**
if (!isLoadLibraries() || cls == null) { return null; if (!checkPlatform(cls, properties)) { throw new UnsatisfiedLinkError("Platform \"" + properties.getProperty("platform") + "\" not supported by " + cls); cls = getEnclosingClass(cls); ClassProperties p = loadProperties(cls, properties, true); cacheDir = getCacheDir().getCanonicalPath(); } catch (IOException e) { for (String preload : preloads) { try { URL[] urls = findLibrary(cls, p, preload, pathsFirst); String filename = loadLibrary(urls, preload); if (filename != null) { preloaded.add(filename); createLibraryLink(filename, p, preload); URL[] urls = findLibrary(cls, p, library, pathsFirst); String filename = loadLibrary(urls, library, preloaded.toArray(new String[preloaded.size()])); if (cacheDir != null && filename != null && filename.startsWith(cacheDir)) { createLibraryLink(filename, p, library);
/** * 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); } /**
/** * 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); } /**
public void clientCode(Loader loader) { try{ string s = loader.load(); catch (NotFoundException ex){ // handle it } }
public static void tryLoad() throws Exception { if (loadingException != null) { throw loadingException; } else { try { Loader.load(org.bytedeco.javacpp.avutil.class); Loader.load(org.bytedeco.javacpp.swresample.class); Loader.load(org.bytedeco.javacpp.avcodec.class); Loader.load(org.bytedeco.javacpp.avformat.class); Loader.load(org.bytedeco.javacpp.swscale.class); /* initialize libavcodec, and register all codecs and formats */ av_jni_set_java_vm(Loader.getJavaVM(), null); avcodec_register_all(); av_register_all(); avformat_network_init(); Loader.load(org.bytedeco.javacpp.avdevice.class); avdevice_register_all(); } catch (Throwable t) { if (t instanceof Exception) { throw loadingException = (Exception)t; } else { throw loadingException = new Exception("Failed to load " + FFmpegFrameRecorder.class, t); } } } }
/** Returns {@code load(cls, loadProperties(), Loader.pathsFirst)}. */ public static String load(Class cls) { return load(cls, loadProperties(), Loader.pathsFirst); } /**
boolean match = platform.extension().length == 0 || (Loader.isLoadLibraries() && platformExtension == null); for (String s : platform.extension()) { if (platformExtension != null && platformExtension.length() > 0 && platformExtension.endsWith(s)) {
String[] resources = properties.get("platform.preloadresource").toArray(new String[0]); String libpath = System.getProperty("java.library.path", ""); if (libpath.length() > 0 && (pathsFirst || !isLoadLibraries() || reference)) { + (extension == null ? "" : extension) + "/"; try { URL u = findResource(cls, subdir + styles[i]); if (u != null) { if (reference) {
if (!isLoadLibraries()) { return null; } catch (Exception exc) { File f = cacheResource(url, filename); try { if (f != null) {
public void load(Class cls, boolean inherit) { Class<?> c = Loader.getEnclosingClass(cls); List<Class> classList = new ArrayList<Class>(); classList.add(0, c); boolean match = p.extension().length == 0 || (Loader.isLoadLibraries() && platformExtension == null); for (String s : p.extension()) { if (platformExtension != null && platformExtension.length() > 0 && platformExtension.endsWith(s)) {
static public List<CvRect> detectBlobs(IplImage input){ IplImage clone = input.clone(); CvMemStorage storage = CvMemStorage.create(); CvSeq contour = new CvSeq(null); cvFindContours(clone, storage, contour, Loader.sizeof(CvContour.class), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); //vlog(crossMask); List<CvRect> rects = Lists.newArrayList(); while (contour != null && !contour.isNull()) { if (contour.elem_size() > 0) { CvRect boundingRect = cvBoundingRect(contour,0); rects.add(boundingRect); } contour = contour.h_next(); } return rects; }
/** * 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); } /**
/** * 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); } /**
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) {
/** * Loads the native fftw3 library. * This method has to be called before using any of the bindings to fftw or cpp * (i.e. {@link DoublePointer} or {@link fftw_plan} and the like). */ public static void initFFTW(){ if(!setupDone){ synchronized (FFTW_Initializer.class) { if(!setupDone){ String loadedlib = Loader.load(fftw3.class); setupDone = true; System.out.format("Loaded FFTW library [%s]%n",loadedlib); } } } }
public static void tryLoad() throws Exception { if (loadingException != null) { throw loadingException; } else { try { Loader.load(org.bytedeco.javacpp.avutil.class); Loader.load(org.bytedeco.javacpp.swresample.class); Loader.load(org.bytedeco.javacpp.avcodec.class); Loader.load(org.bytedeco.javacpp.avformat.class); Loader.load(org.bytedeco.javacpp.swscale.class); // Register all formats and codecs av_jni_set_java_vm(Loader.getJavaVM(), null); avcodec_register_all(); av_register_all(); avformat_network_init(); Loader.load(org.bytedeco.javacpp.avdevice.class); avdevice_register_all(); } catch (Throwable t) { if (t instanceof Exception) { throw loadingException = (Exception)t; } else { throw loadingException = new Exception("Failed to load " + FFmpegFrameGrabber.class, t); } } } }
@Override public void init(ClassProperties properties) { String platform = properties.getProperty("platform"); List<String> preloads = properties.get("platform.preload"); // Only apply this at load time since we don't want to copy the CUDA libraries here if (!Loader.isLoadLibraries() || !platform.equals("linux-x86_64")) { return; } int i = 0; String[] libs = {"cudart", "cublas", "cudnn"}; for (String lib : libs) { lib += lib.equals("cudnn") ? "@.7" : "@.10.0"; if (!preloads.contains(lib)) { preloads.add(i++, lib); } } }