jnr.ffi.provider.InvalidProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jnr-unixsocket-nodep Show documentation
Show all versions of jnr-unixsocket-nodep Show documentation
com.github.jnr:jnr-unixsocket with orh.objectweb.asm shaded
The newest version!
package jnr.ffi.provider;
import jnr.ffi.*;
import jnr.ffi.Runtime;
import java.util.Collection;
import java.util.Map;
final class InvalidProvider extends FFIProvider {
private final String message;
private final Throwable cause;
private final jnr.ffi.Runtime runtime;
InvalidProvider(String message, Throwable cause) {
this.message = message;
this.cause = cause;
this.runtime = new InvalidRuntime(message, cause);
}
@Override
public Runtime getRuntime() {
return runtime;
}
@Override
public LibraryLoader createLibraryLoader(Class interfaceClass) {
return new LibraryLoader(interfaceClass) {
@Override
protected T loadLibrary(Class interfaceClass, Collection libraryNames, Collection searchPaths, Map options) {
UnsatisfiedLinkError error = new UnsatisfiedLinkError(message);
error.initCause(cause);
throw error;
}
};
}
}