本文整理汇总了Java中org.bridj.PointerIO类的典型用法代码示例。如果您正苦于以下问题:Java PointerIO类的具体用法?Java PointerIO怎么用?Java PointerIO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PointerIO类属于org.bridj包,在下文中一共展示了PointerIO类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBridJPointer
import org.bridj.PointerIO; //导入依赖的package包/类
private static final <T> Pointer<T> getBridJPointer(final long pBufferAddress,
final long pBufferLength,
final Class<T> pTargetClass)
{
final PointerIO<?> lPointerIO = PointerIO.getInstance(pTargetClass);
final Releaser lReleaser = new Releaser()
{
@Override
public void release(Pointer<?> pP)
{
// can't control life-cycle of
}
};
@SuppressWarnings("unchecked")
final Pointer<T> lPointerToAddress = (Pointer<T>) Pointer.pointerToAddress( pBufferAddress,
pBufferLength,
lPointerIO,
lReleaser);
return lPointerToAddress;
}
示例2: getArrayIO
import org.bridj.PointerIO; //导入依赖的package包/类
static <T> PointerIO<T> getArrayIO(Object array) {
#foreach ($prim in $primitives)
if (array instanceof ${prim.Name}[])
return (PointerIO)CommonPointerIOs.${prim.Name}IO;
#end
return PointerIO.getInstance(array.getClass().getComponentType());
}
示例3: getInstance
import org.bridj.PointerIO; //导入依赖的package包/类
public static <S extends StructObject> PointerIO<S> getInstance(StructIO s) {
PointerIO io = structIOs.get(s);
if (io == null) {
io = new CommonPointerIOs.StructPointerIO(s);
PointerIO previousIO = structIOs.putIfAbsent(s, io);
if (previousIO != null)
io = previousIO;
}
return io;
}
示例4: getBufferPrimitiveInstance
import org.bridj.PointerIO; //导入依赖的package包/类
public static <P> PointerIO<P> getBufferPrimitiveInstance(Buffer buffer) {
#foreach ($prim in $primitivesNoBool)
if (buffer instanceof ${prim.BufferName})
return (PointerIO)CommonPointerIOs.${prim.Name}IO;
#end
throw new UnsupportedOperationException();
}
示例5: allocateCOMMemory
import org.bridj.PointerIO; //导入依赖的package包/类
protected <V> Pointer<V> allocateCOMMemory(PointerIO<V> pointerIO) {
return allocateCOMMemory(pointerIO.getTargetSize(), pointerIO);
}
示例6: newCPPInstance
import org.bridj.PointerIO; //导入依赖的package包/类
protected <T extends CPPObject> Pointer<T> newCPPInstance(T instance, final Type type, int constructorId, Object... args) {
Pointer<T> peer = null;
try {
final Class<T> typeClass = Utils.getClass(type);
NativeLibrary lib = BridJ.getNativeLibrary(typeClass);
if (BridJ.debug) {
info("Creating C++ instance of type " + type + " with args " + Arrays.asList(args));
}
Pointer.Releaser releaser = newCPPReleaser(type, typeClass, lib);
long size = sizeOf(type, null);
peer = (Pointer) Pointer.allocateBytes(PointerIO.getInstance(type), size, releaser).as(type);
DynamicFunction<?> constructor = constructorId == SKIP_CONSTRUCTOR ? null : getConstructor(typeClass, type, lib, constructorId);
if (lib != null && CPPObject.class.isAssignableFrom(typeClass)) {
installRegularVTablePtr(type, lib, peer);
} else {
// TODO ObjCObject : call alloc on class type !!
}
// Calling the constructor with the non-template parameters :
if (constructor != null) {
Object[] consThisArgs = new Object[1 + args.length];
consThisArgs[0] = peer;
System.arraycopy(args, 0, consThisArgs, 1, args.length);
constructor.apply(consThisArgs);
}
// Install synthetic virtual table and associate the Java instance to the corresponding native pointer :
if (CPPObject.class.isAssignableFrom(typeClass)) {
if (installSyntheticVTablePtr(type, lib, peer)) {
BridJ.setJavaObjectFromNativePeer(peer.getPeer(), instance);
}
} else {
// TODO ObjCObject : call alloc on class type !!
}
return peer;
} catch (Exception ex) {
ex.printStackTrace();
if (peer != null) {
peer.release();
}
throw new RuntimeException("Failed to allocate new instance of type " + type, ex);
}
}
示例7: PointerIO
import org.bridj.PointerIO; //导入依赖的package包/类
public PointerIO(Type targetType, int targetSize, Class<?> typedPointerClass) {
this.targetType = targetType;
this.targetSize = targetSize;
this.typedPointerClass = typedPointerClass;
}
示例8: getReferenceIO
import org.bridj.PointerIO; //导入依赖的package包/类
PointerIO<Pointer<T>> getReferenceIO() {
return new CommonPointerIOs.PointerPointerIO<T>(this);
}
示例9: getPointerInstance
import org.bridj.PointerIO; //导入依赖的package包/类
public static <T> PointerIO<Pointer<T>> getPointerInstance(Type target) {
return getPointerInstance((PointerIO<T>)getInstance(target));
}
示例10: getArrayInstance
import org.bridj.PointerIO; //导入依赖的package包/类
public static <T> PointerIO<Pointer<T>> getArrayInstance(PointerIO<T> targetIO, long[] dimensions, int iDimension) {
return new CommonPointerIOs.PointerArrayIO<T>(targetIO, dimensions, iDimension);
}
示例11: getTimeTInstance
import org.bridj.PointerIO; //导入依赖的package包/类
public static PointerIO<TimeT> getTimeTInstance() {
return (PointerIO)CommonPointerIOs.TimeTIO;
}