Package de.intarsys.nativec.jna
Class JnaNativeInterface
- java.lang.Object
-
- de.intarsys.nativec.jna.JnaNativeInterface
-
- All Implemented Interfaces:
INativeInterface
public class JnaNativeInterface extends java.lang.Object implements INativeInterface
AnINativeInterfaceimplemented using JNA, a LGPL licensed Java native interface abstraction.In our point of view, JNA has the power of deploying all what we wanted to have, but is ill designed in some key hot spots - so we worked around and built on top of our own interfaces.
-
-
Constructor Summary
Constructors Constructor Description JnaNativeInterface()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSearchPath(java.lang.String path)Add a directory to the search path.INativeHandleallocate(int size)Allocate c memory and return the respectiveINativeHandle.INativeCallbackcreateCallback(ICallback callback)INativeFunctioncreateFunction(long address)Create anINativeFunctionfrom a function pointer.INativeHandlecreateHandle(long address)Create a voidINativeHandleto a memory address.INativeLibrarycreateLibrary(java.lang.String name)Load a newINativeLibrary.protected java.util.List<java.lang.String>getSearchPaths()intlongSize()The platform long size.intpointerSize()The platform pointer size.intwideCharSize()The platform wide char size.
-
-
-
Method Detail
-
addSearchPath
public void addSearchPath(java.lang.String path)
Description copied from interface:INativeInterfaceAdd a directory to the search path.- Specified by:
addSearchPathin interfaceINativeInterface- Parameters:
path- The path to be added;
-
allocate
public INativeHandle allocate(int size)
Description copied from interface:INativeInterfaceAllocate c memory and return the respectiveINativeHandle.- Specified by:
allocatein interfaceINativeInterface- Parameters:
size- The size in bytes.- Returns:
- The new allocated
INativeHandle
-
createCallback
public INativeCallback createCallback(ICallback callback)
- Specified by:
createCallbackin interfaceINativeInterface
-
createFunction
public INativeFunction createFunction(long address)
Description copied from interface:INativeInterfaceCreate anINativeFunctionfrom a function pointer.There is no special handling for the 0 address!
- Specified by:
createFunctionin interfaceINativeInterface- Parameters:
address- The function pointer.- Returns:
- The function object.
-
createHandle
public INativeHandle createHandle(long address)
Description copied from interface:INativeInterfaceCreate a voidINativeHandleto a memory address.There is no special handling for the 0 address!
- Specified by:
createHandlein interfaceINativeInterface- Parameters:
address- The memory address.- Returns:
- The handle to the memory address.
-
createLibrary
public INativeLibrary createLibrary(java.lang.String name)
Description copied from interface:INativeInterfaceLoad a newINativeLibrary.- Specified by:
createLibraryin interfaceINativeInterface- Parameters:
name- The name of the library to load.- Returns:
- The new
INativeLibrary
-
getSearchPaths
protected java.util.List<java.lang.String> getSearchPaths()
-
longSize
public int longSize()
Description copied from interface:INativeInterfaceThe platform long size.- Specified by:
longSizein interfaceINativeInterface- Returns:
- The platform long size.
-
pointerSize
public int pointerSize()
Description copied from interface:INativeInterfaceThe platform pointer size.- Specified by:
pointerSizein interfaceINativeInterface- Returns:
- The platform pointer size.
-
wideCharSize
public int wideCharSize()
Description copied from interface:INativeInterfaceThe platform wide char size.- Specified by:
wideCharSizein interfaceINativeInterface- Returns:
- The platform wide char size.
-
-