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
AnINativeInterface
implemented 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 void
addSearchPath(java.lang.String path)
Add a directory to the search path.INativeHandle
allocate(int size)
Allocate c memory and return the respectiveINativeHandle
.INativeCallback
createCallback(ICallback callback)
INativeFunction
createFunction(long address)
Create anINativeFunction
from a function pointer.INativeHandle
createHandle(long address)
Create a voidINativeHandle
to a memory address.INativeLibrary
createLibrary(java.lang.String name)
Load a newINativeLibrary
.protected java.util.List<java.lang.String>
getSearchPaths()
int
longSize()
The platform long size.int
pointerSize()
The platform pointer size.int
wideCharSize()
The platform wide char size.
-
-
-
Method Detail
-
addSearchPath
public void addSearchPath(java.lang.String path)
Description copied from interface:INativeInterface
Add a directory to the search path.- Specified by:
addSearchPath
in interfaceINativeInterface
- Parameters:
path
- The path to be added;
-
allocate
public INativeHandle allocate(int size)
Description copied from interface:INativeInterface
Allocate c memory and return the respectiveINativeHandle
.- Specified by:
allocate
in interfaceINativeInterface
- Parameters:
size
- The size in bytes.- Returns:
- The new allocated
INativeHandle
-
createCallback
public INativeCallback createCallback(ICallback callback)
- Specified by:
createCallback
in interfaceINativeInterface
-
createFunction
public INativeFunction createFunction(long address)
Description copied from interface:INativeInterface
Create anINativeFunction
from a function pointer.There is no special handling for the 0 address!
- Specified by:
createFunction
in interfaceINativeInterface
- Parameters:
address
- The function pointer.- Returns:
- The function object.
-
createHandle
public INativeHandle createHandle(long address)
Description copied from interface:INativeInterface
Create a voidINativeHandle
to a memory address.There is no special handling for the 0 address!
- Specified by:
createHandle
in 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:INativeInterface
Load a newINativeLibrary
.- Specified by:
createLibrary
in 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:INativeInterface
The platform long size.- Specified by:
longSize
in interfaceINativeInterface
- Returns:
- The platform long size.
-
pointerSize
public int pointerSize()
Description copied from interface:INativeInterface
The platform pointer size.- Specified by:
pointerSize
in interfaceINativeInterface
- Returns:
- The platform pointer size.
-
wideCharSize
public int wideCharSize()
Description copied from interface:INativeInterface
The platform wide char size.- Specified by:
wideCharSize
in interfaceINativeInterface
- Returns:
- The platform wide char size.
-
-