de.intarsys.nativec.jna
Class JnaNativeInterface

java.lang.Object
  extended by de.intarsys.nativec.jna.JnaNativeInterface
All Implemented Interfaces:
INativeInterface

public class JnaNativeInterface
extends java.lang.Object
implements INativeInterface

An INativeInterface 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
JnaNativeInterface()
           
 
Method Summary
 void addSearchPath(java.lang.String path)
          Add a directory to the search path.
 INativeHandle allocate(int size)
          Allocate c memory and return the respective INativeHandle.
 INativeCallback createCallback(ICallback callback)
           
 INativeFunction createFunction(long address)
          Create an INativeFunction from a function pointer.
 INativeHandle createHandle(long address)
          Create a void INativeHandle to a memory address.
 INativeLibrary createLibrary(java.lang.String name)
          Load a new INativeLibrary.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JnaNativeInterface

public JnaNativeInterface()
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 interface INativeInterface
Parameters:
path - The path to be added;

allocate

public INativeHandle allocate(int size)
Description copied from interface: INativeInterface
Allocate c memory and return the respective INativeHandle.

Specified by:
allocate in interface INativeInterface
Parameters:
size - The size in bytes.
Returns:
The new allocated INativeHandle

createCallback

public INativeCallback createCallback(ICallback callback)
Specified by:
createCallback in interface INativeInterface

createFunction

public INativeFunction createFunction(long address)
Description copied from interface: INativeInterface
Create an INativeFunction from a function pointer.

There is no special handling for the 0 address!

Specified by:
createFunction in interface INativeInterface
Parameters:
address - The function pointer.
Returns:
The function object.

createHandle

public INativeHandle createHandle(long address)
Description copied from interface: INativeInterface
Create a void INativeHandle to a memory address.

There is no special handling for the 0 address!

Specified by:
createHandle in interface INativeInterface
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 new INativeLibrary.

Specified by:
createLibrary in interface INativeInterface
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 interface INativeInterface
Returns:
The platform long size.

pointerSize

public int pointerSize()
Description copied from interface: INativeInterface
The platform pointer size.

Specified by:
pointerSize in interface INativeInterface
Returns:
The platform pointer size.

wideCharSize

public int wideCharSize()
Description copied from interface: INativeInterface
The platform wide char size.

Specified by:
wideCharSize in interface INativeInterface
Returns:
The platform wide char size.