com.jniwrapper package contains classes that allow calling native functions from Java(TM) code.See: Description
| Interface | Description |
|---|---|
| AlignmentAwareParameter |
Internal interface, required for alignment calculation
|
| ArrayParameter |
Common interface for all types representing arrays.
|
| AutoDeleteParameter |
This class represents resource that could be deleted automatically or manually.
|
| CompositeParameter |
Marker interface that identifies type that should be
marshalled as a set of bytes (Structure and Union are typical usages)
|
| DataBuffer |
Basic interface to any memory location where JNIWrapper types can store their
data.
|
| FloatParameter |
Common interface for all floating-point types.
|
| IntegerParameter |
Common interface for all integer types.
|
| IOPerformer |
Parameter I/O visitor interface.
|
| LibraryLoader |
Basic interface for classes that can find and load a native library.
|
| MemoryBuffer |
Data source associated with an allocated native memory block.
|
| NativeResource |
Interface for releasing native resources.
|
| PointerParameter |
Marker interface that identifies pointer parameter.
|
| StringParameter |
This is a generic interface for all parameters holding a string value.
|
| Class | Description |
|---|---|
| AbstractBuffer | |
| AbstractFloat |
Base class for all floating-point types.
|
| AnsiString |
Represents a zero-terminated string of an 8-bit (ANSI) character declared in
C as
char[n], where n is the length of the buffer. |
| AnsiStringArray |
This type is specially designed for reading/writing double zero terminated (Ansi) string arrays.
|
| ArithmeticalPointer |
Pointer to a place within an allocated structure that handles reading and
writing of offset pointer values.
|
| BitField |
Represents a bit field for structures.
|
| Bool |
Represents a
bool (boolean) value and type. |
| ByteArrayBufferBE | |
| Callback |
Callback is a superclass for all classes representing callback functions. |
| Char |
Represents the
char value and type. |
| CharacterEncoding |
Enumeration of supported characters encodings.
|
| ComplexArray |
Represents an array of objects.
|
| Const |
Represents a read-only parameter.
|
| DataBufferFactory |
Abstract base for factory classes that produce instances of appropriate
DataBuffer implementation. |
| DefaultLibraryLoader |
Default implementation for
LibraryLoader that realizes Singleton
pattern. |
| DelegatingParameter |
Base class for all parameter types that wrap around other types.
|
| DoubleFloat |
Represents
double float value and type. |
| ExternalArrayPointer |
A pointer to an array returned from the native code.
|
| ExternalStringArray |
This class allows reading external memory block that contains a sequence of
null-terminated strings.
|
| ExternalStringPointer |
This class is designed for reading externally allocated strings.
|
| Function |
The
Function class allows to call a specified function
from a native code library. |
| FunctionCall |
This is a helper class for improving performance of a function invocation.
|
| Int |
C-like
int value. |
| Int16 |
Represents a 16-bit integer value and type.
|
| Int32 |
Represents a 32-bit integer value and type.
|
| Int64 |
Represents a 64-bit integer value and type.
|
| Int8 |
Represents an 8-bit integer (byte) value and type.
|
| IntBool |
This class represents four bytes boolean type.
|
| JNIWrapperInfo |
This class provides information about configuration of JNIWrapper.
|
| Library |
This class provides operations with a native code library.
|
| LongDouble |
Represents
long double value and type. |
| LongInt |
C-like
long value. |
| NativeResourceCollector |
Garbage collection assistant for native resources.
|
| NullBuffer | |
| OutOnly |
Represents a parameter that is only written by a native function.
|
| Parameter |
Common parent class for all types of function parameters.
|
| ParameterBufferImpl | |
| ParameterHelperMacOsIntel64 | |
| ParameterHelperSunOSSparc64 | |
| PlatformContext |
Provides information on platform-dependent type sizes, etc.
|
| Pointer |
This class represents a pointer to object in terms of C language.
|
| Pointer.Const |
Represents a pointer to constant object.
|
| Pointer.OutOnly |
Represents a pointer to object with undefined initial value.
|
| Pointer.Void |
Represents a
void *. |
| PrimitiveArray |
Represents an array of primitive types such as array of bytes or array of
integer values.
|
| ResizingPointer |
A pointer to an array that can be resized (reallocated) on the native side.
|
| ShortInt |
C-like
short value. |
| SingleFloat |
Represents the
float value and type. |
| Str |
Represents a string data that depends on Unicode support of an operating
system under which the code is being executed.
|
| StringArray |
Represents a string array where strings are delimited by the zero character.
|
| Structure |
The class represents structures in terms of C language.
|
| SunOSSparc64PlatformSupport | |
| SunOSSparcPlatformSupport | |
| UInt |
C-like
unsigned int value. |
| UInt16 |
Represents a 16-bit unsigned integer value and type.
|
| UInt32 |
Represents a 32-bit unsigned integer value and type.
|
| UInt64 |
Represents 64-bit unsigned integer type specially designed to support UINT64 native type.
|
| UInt8 |
Represents an 8-bit unsigned integer value and type.
|
| ULongInt |
C-like
unsigned long value. |
| UnicodeChar |
Represents a Unicode character (
wchar_t) for Unix platform. |
| UnicodeString |
Represents a Unicode string (
wchar_t *) for Unix platform. |
| Union |
Represents a C
union type. |
| Unused |
Represents a parameter which is not accessed in a native function.
|
| UShortInt |
C-like
unsigned short value. |
| WideChar |
Represents a Unicode character (
wchar_t) |
| WideString |
Represents Unicode string (
wchar_t[n]) value and type, where n is the length of the buffer.. |
| WideStringArray |
This type is specially designed for reading/writing double zero terminated (Unicode) string arrays.
|
| ZeroTerminatedString |
Base class for all types of zero-terminated strings.
|
| Exception | Description |
|---|---|
| FunctionExecutionException |
This exception is thrown if an error occurs during a native function call.
|
| JNIWrapperException |
Is made for compatibility with JDK 1.3.x
|
| LibraryNotFoundException |
This exception is thrown when a native library cannot be loaded.
|
| LibraryVersionMismatchException |
This exception is thrown when there is a native library but it is not compatible with
the current JNIWrapper version. |
| MemoryAccessViolationException |
This exception is thrown when a native library code attempts to reference an
invalid memory location.
|
| NoSuchFunctionException |
Indicates that a requested native function was not found in the specified
library.
|
| NoSuchVariableException |
Indicates that a requested native function was not found in the specified
library.
|
com.jniwrapper package contains classes that allow calling native functions from Java(TM) code.
Calling native functions is quite simple if you follow these steps:
DefaultLibraryLoader contains all your PATH entries and
gives you ability to add your own:
DefaultLibraryLoader.getInstance().addPath(new File("path/to/my/code"));
As the name suggests this class is used by default to load native libraries.
LongInt retVal = new LongInt(0);
WideString str = new WideString(256);
UInt32 len = new UInt32(256);
Library kernel = new Library("kernel32");
kernel.getFunction("GetCurrentDirectoryW", null).invoke(retVal, len, new Pointer.OutOnly(str));
System.out.println("Current working directory is: " + str.getValue());