本文整理了Java中com.sun.jna.Function.invokePointer()
方法的一些代码示例,展示了Function.invokePointer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.invokePointer()
方法的具体详情如下:
包路径:com.sun.jna.Function
类名称:Function
方法名:invokePointer
[英]Convenience method for #invoke(Class,Object[]).
[中]方便的#invoke方法(类,对象[])。
代码示例来源:origin: net.java.dev.jna/jna
/**
* Call the native function being represented by this object
*
* @param callFlags calling convention to be used
* @param args
* Arguments to pass to the native function
* @param wide whether the native string uses <code>wchar_t</code>;
* if false, <code>char</code> is assumed
* @return The value returned by the target native function, as a String
*/
private String invokeString(int callFlags, Object[] args, boolean wide) {
Pointer ptr = invokePointer(callFlags, args);
String s = null;
if (ptr != null) {
if (wide) {
s = ptr.getWideString(0);
}
else {
s = ptr.getString(0, encoding);
}
}
return s;
}
代码示例来源:origin: net.java.dev.jna/jna
return invokePointer(callFlags, args);
} else if (Structure.class.isAssignableFrom(returnType)) {
if (Structure.ByValue.class.isAssignableFrom(returnType)) {
result = s;
} else {
result = invokePointer(callFlags, args);
if (result != null) {
Structure s = Structure.newInstance((Class<? extends Structure>)returnType, (Pointer)result);
result = invokePointer(callFlags, args);
if (result != null) {
result = CallbackReference.getCallback(returnType, (Pointer)result);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
result = p.getStringArray(0, encoding);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
String[] arr = p.getWideStringArray(0);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
result = p.getPointerArray(0);
代码示例来源:origin: org.netbeans.api/org-jruby
public final IRubyObject invoke(Ruby runtime, Function function, Object[] args) {
return new JNAMemoryPointer(runtime, function.invokePointer(args));
}
public static final FunctionInvoker INSTANCE = new PointerInvoker();
代码示例来源:origin: org.elasticsearch/jna
/**
* Call the native function being represented by this object
*
* @param callFlags calling convention to be used
* @param args
* Arguments to pass to the native function
* @param wide whether the native string uses <code>wchar_t</code>;
* if false, <code>char</code> is assumed
* @return The value returned by the target native function, as a String
*/
private String invokeString(int callFlags, Object[] args, boolean wide) {
Pointer ptr = invokePointer(callFlags, args);
String s = null;
if (ptr != null) {
if (wide) {
s = ptr.getWideString(0);
}
else {
s = ptr.getString(0, encoding);
}
}
return s;
}
代码示例来源:origin: org.elasticsearch/jna
return invokePointer(callFlags, args);
} else if (Structure.class.isAssignableFrom(returnType)) {
if (Structure.ByValue.class.isAssignableFrom(returnType)) {
result = s;
} else {
result = invokePointer(callFlags, args);
if (result != null) {
Structure s = Structure.newInstance(returnType, (Pointer)result);
result = invokePointer(callFlags, args);
if (result != null) {
result = CallbackReference.getCallback(returnType, (Pointer)result);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
result = p.getStringArray(0, encoding);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
String[] arr = p.getWideStringArray(0);
Pointer p = invokePointer(callFlags, args);
if (p != null) {
result = p.getPointerArray(0);
代码示例来源:origin: com.sun.jna/jna
result = invokePointer(callingConvention, args);
if (result != null) {
Structure s = Structure.newInstance(returnType);
result = invokePointer(callingConvention, args);
if (result != null) {
result = CallbackReference.getCallback(returnType, (Pointer)result);
代码示例来源:origin: org.netbeans.api/org-jruby
public final IRubyObject invoke(Ruby runtime, Function function, Object[] args) {
Pointer address = function.invokePointer(args);
if (address == null) {
return runtime.getNil();
}
int len = (int) address.indexOf(0, (byte) 0);
if (len == 0) {
return RubyString.newEmptyString(runtime);
}
ByteList bl = new ByteList(len);
bl.length(len);
address.read(0, bl.unsafeBytes(), bl.begin(), len);
return RubyString.newString(runtime, bl);
}
public static final FunctionInvoker INSTANCE = new StringInvoker();
内容来源于网络,如有侵权,请联系作者删除!