SilverStream
Application Server 3.5

com.sssw.rt.com
Class DllLib

java.lang.Object
 |
 +--com.sssw.rt.com.DllLib

public class DllLib
extends Object

This class contains a collection of static methods intended to be used in support of direct calls to DLLs. These methods must be used with great care. They manipulate native memory pointers and can cause memory corruption by bypassing the safeguards of the Java Virtual Machine.


Constructor Summary
DllLib()
           
 
Method Summary
static int allocCoTaskMem(int size)
          Allocate a Native Global Memory Block of the specified size.
static int allocHGlobal(int size)
          Allocate a Native Global Memory Block of the specified size.
static int call(int pproc)
          Direct call into a DLL with no parameters.
static int call(int pproc, int p1)
          Direct call into a DLL with one parameter.
static int call(int pproc, int p1, int p2)
          Direct call into a DLL with two parameters.
static int call(int pproc, int p1, int p2, int p3)
          Direct call into a DLL with three parameters.
static int call(int pproc, int p1, int p2, int p3, int p4)
          Direct call into a DLL with four parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5)
          Direct call into a DLL with five parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6)
          Direct call into a DLL with six parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7)
          Direct call into a DLL with seven parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
          Direct call into a DLL with eight parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9)
          Direct call into a DLL with nine parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10)
          Direct call into a DLL with ten parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11)
          Direct call into a DLL with eleven parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12)
          Direct call into a DLL with twelve parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12, int p13)
          Direct call into a DLL with thirteen parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12, int p13, int p14)
          Direct call into a DLL with fourteen parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12, int p13, int p14, int p15)
          Direct call into a DLL with fifteen parameters.
static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10, int p11, int p12, int p13, int p14, int p15, int p16)
          Direct call into a DLL with sixteen parameters.
static void copy(byte[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java byte array to a native buffer.
static void copy(char[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java char array to a native buffer.
static void copy(double[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java double array to a native buffer.
static void copy(float[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java float array to a native buffer.
static void copy(int[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java int array to a native buffer.
static void copy(int pmem, byte[] jarray, int idx, int nelems)
          Copy data to a Java array of byte's from a native memory buffer.
static void copy(int pmem, char[] jarray, int idx, int nelems)
          Copy data to a Java array of char's from a native memory buffer.
static void copy(int pmem, double[] jarray, int idx, int nelems)
          Copy data to a Java array of double's from a native memory buffer.
static void copy(int pmem, float[] jarray, int idx, int nelems)
          Copy data to a Java array of float's from a native memory buffer.
static void copy(int pmem, int[] jarray, int idx, int nelems)
          Copy data to a Java array of int's from a native memory buffer.
static void copy(int pmem, long[] jarray, int idx, int nelems)
          Copy data to a Java array of long's from a native memory buffer.
static void copy(int pmem, short[] jarray, int idx, int nelems)
          Copy data to a Java array of short's from a native memory buffer.
static void copy(long[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java long array to a native buffer.
static void copy(short[] jarray, int idx, int pmem, int nelems)
          Copy data from a Java short array to a native buffer.
static int DLLFreeHandle(int handle)
          Free a DLL that was loaded with DLLGetHandle.
static int DLLGetHandle(String path)
          Load a DLL by name.
static int DLLGetMethod(int handle, String methodname)
          Get a pointer to a function in a DLL.
static void fillArray(byte[] jarray, int pmem)
          Fill a java array of bytes from a native memory buffer.
static void fillArray(char[] jarray, int pmem)
          Fill a java array of char's from a native memory buffer.
static void fillArray(double[] jarray, int pmem)
          Fill a java array of double's from a native memory buffer.
static void fillArray(float[] jarray, int pmem)
          Fill a java array of float's from a native memory buffer.
static void fillArray(int[] jarray, int pmem)
          Fill a java array of int's from a native memory buffer.
static void fillArray(long[] jarray, int pmem)
          Fill a java array of long's from a native memory buffer.
static void fillArray(short[] jarray, int pmem)
          Fill a java array of short's from a native memory buffer.
static void freeCoTaskMem(int ptr)
          Free a Native Global Memory Block.
static void freeHGlobal(int ptr)
          Free a Native Global Memory Block.
static int getPointer(byte[] jarray)
          Return a native buffer containing the contents of a Java byte array.
static int getPointer(char[] jarray)
          Return a native buffer containing the contents of a Java char array.
static int getPointer(double[] jarray)
          Return a native buffer containing the contents of a Java double array.
static int getPointer(float[] jarray)
          Return a native buffer containing the contents of a Java float array.
static int getPointer(int[] jarray)
          Return a native buffer containing the contents of a Java ing array.
static int getPointer(long[] jarray)
          Return a native buffer containing the contents of a Java long array.
static int getPointer(short[] jarray)
          Return a native buffer containing the contents of a Java short array.
static String ptrToStringAnsi(int ptr)
          Create a Java String from a native Ansi buffer.
static StringBuffer ptrToStringBufferAnsi(int ptr, StringBuffer stringbuf)
          Set the contents of a StringBuffer from a native buffer.
static StringBuffer ptrToStringBufferUni(int ptr, StringBuffer stringbuf)
          Set the contents of a StringBuffer from a native Unicode buffer.
static String ptrToStringUni(int ptr)
          Create a Java String from a native Unicode buffer.
static byte read1(int pmem, int offset)
          Read a single byte from the specified offset in a native memory block.
static short read2(int pmem, int offset)
          Read a two byte value from the specified offset in a native memory block.
static int read4(int pmem, int offset)
          Read a 4-byte integer value from the specified offset in a native memory block.
static int stringToPtrAnsi(String string)
          Convert a java.lang.String into to a native Ansi buffer.
static int stringToPtrUni(String string)
          Convert a java.lang.String into to a native Unicode buffer.
static void write1(int pmem, int offset, byte value)
          Write a single byte to the specified offset of a native memory block.
static void write2(int pmem, int offset, short value)
          Write a two byte integer value to the specified offset of a native memory block.
static void write4(int pmem, int offset, int value)
          Write a four byte integer value to the specified offset of a native memory block.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DllLib

public DllLib()
Method Detail

DLLGetHandle

public static int DLLGetHandle(String path)
Load a DLL by name.
Parameters:
path - the absolute path of a DLL
Returns:
handle to a DLL if success, zero if failure.

DLLFreeHandle

public static int DLLFreeHandle(int handle)
Free a DLL that was loaded with DLLGetHandle. This method is rarely used.
Parameters:
handle - a native pointer returned by DLLGetHandle
Returns:
non-zero value if success, zero if failure.
See Also:
DllLib.DLLGetHandle(String path)

DLLGetMethod

public static int DLLGetMethod(int handle,
                               String methodname)
Get a pointer to a function in a DLL.
Parameters:
handle - native pointer to DLL that was loaded using DLLGetHandle
methodname - function name to be loaded
Returns:
native pointer to a function in a DLL if success, zero if failure
See Also:
DllLib.DLLGetHandle(String path)

call

public static int call(int pproc)
Direct call into a DLL with no parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1)
Direct call into a DLL with one parameter.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
p1 - argument to the function call must be converted into int by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2)
Direct call into a DLL with two parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3)
Direct call into a DLL with three parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4)
Direct call into a DLL with four parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5)
Direct call into a DLL with five parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6)
Direct call into a DLL with six parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7)
Direct call into a DLL with seven parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8)
Direct call into a DLL with eight parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9)
Direct call into a DLL with nine parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10)
Direct call into a DLL with ten parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11)
Direct call into a DLL with eleven parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11,
                       int p12)
Direct call into a DLL with twelve parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11,
                       int p12,
                       int p13)
Direct call into a DLL with thirteen parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11,
                       int p12,
                       int p13,
                       int p14)
Direct call into a DLL with fourteen parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11,
                       int p12,
                       int p13,
                       int p14,
                       int p15)
Direct call into a DLL with fifteen parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

call

public static int call(int pproc,
                       int p1,
                       int p2,
                       int p3,
                       int p4,
                       int p5,
                       int p6,
                       int p7,
                       int p8,
                       int p9,
                       int p10,
                       int p11,
                       int p12,
                       int p13,
                       int p14,
                       int p15,
                       int p16)
Direct call into a DLL with sixteen parameters.
Parameters:
pproc - a pointer to function obtained by calling DLLGetMethod
pN - arguments to the function call must be converted into ints by using the methods in this class such as XXXToPtr, getPointer, AllocHGlobal or AllocCoTaskMem.
Returns:
a pointer to the return value or an int. To get a java value of a pointer use an appropriate method on this class, such as ptrToString or fillArray.

allocHGlobal

public static int allocHGlobal(int size)
Allocate a Native Global Memory Block of the specified size. The block will be Zero-filled.
Parameters:
size - Number of bytes to allocate

freeHGlobal

public static void freeHGlobal(int ptr)
Free a Native Global Memory Block. (The block must have been allocated using allocHGlobal.)
Parameters:
ptr - Native memory pointer

allocCoTaskMem

public static int allocCoTaskMem(int size)
Allocate a Native Global Memory Block of the specified size. The block will be Zero-filled.
Parameters:
size - Number of bytes to allocate

freeCoTaskMem

public static void freeCoTaskMem(int ptr)
Free a Native Global Memory Block. (The block must have been allocated using allocHGlobal.)
Parameters:
ptr - Native memory pointer

read1

public static byte read1(int pmem,
                         int offset)
Read a single byte from the specified offset in a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native memory pointer
offset - The offset into the memory block (in bytes) to read from.
Returns:
the byte value at the specified offset

read2

public static short read2(int pmem,
                          int offset)
Read a two byte value from the specified offset in a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native pointer returned from allocHGlobal or allocCoTaskMem
offset - The offset into the memory block (in bytes) to read from.
Returns:
the short value at the specified offset

read4

public static int read4(int pmem,
                        int offset)
Read a 4-byte integer value from the specified offset in a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native pointer returned from allocHGlobal or allocCoTaskMem
offset - The offset into the memory block (in bytes) to read from.
Returns:
the int value at the specified offset

write1

public static void write1(int pmem,
                          int offset,
                          byte value)
Write a single byte to the specified offset of a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native pointer returned from allocHGlobal or allocCoTaskMem
offset - The offset into the memory block (in bytes) where the byte is to be written

write2

public static void write2(int pmem,
                          int offset,
                          short value)
Write a two byte integer value to the specified offset of a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native pointer returned from allocHGlobal or allocCoTaskMem
offset - The offset into the memory block (in bytes) where the bytes are to be written

write4

public static void write4(int pmem,
                          int offset,
                          int value)
Write a four byte integer value to the specified offset of a native memory block. The block must have been allocated using allocHGlobal, allocCoTaskMem, stringToPtrUni, or stringToPtrAnsi.
Parameters:
pmem - Native pointer returned from allocHGlobal or allocCoTaskMem
offset - The offset into the memory block (in bytes) where the bytes are to be written

stringToPtrUni

public static int stringToPtrUni(String string)
Convert a java.lang.String into to a native Unicode buffer.
Parameters:
string - The Java string to be placed into native memory
Returns:
a native memory pointer to a block containing a null-terminated Unicode string.

stringToPtrAnsi

public static int stringToPtrAnsi(String string)
Convert a java.lang.String into to a native Ansi buffer.
Parameters:
string - The Java string to be placed into native memory
Returns:
a native memory pointer to a block containing a null-terminated Ansi string.

ptrToStringAnsi

public static String ptrToStringAnsi(int ptr)
Create a Java String from a native Ansi buffer.
Parameters:
ptr - Pointer to a native buffer (typically returned from stringToPointerAnsi) containing a null-terminated Ansi string.
Returns:
a Java Unicode String created from the contents of the null-terminated Ansi string in the specified native buffer

ptrToStringUni

public static String ptrToStringUni(int ptr)
Create a Java String from a native Unicode buffer.
Parameters:
ptr - Pointer to a native buffer (typically returned from stringToPointerAnsi) containing a null-terminated Unicode string.
Returns:
a Java Unicode String created from the contents of the null-terminated Ansi string in the specified native buffer

ptrToStringBufferAnsi

public static StringBuffer ptrToStringBufferAnsi(int ptr,
                                                 StringBuffer stringbuf)
Set the contents of a StringBuffer from a native buffer.
Parameters:
ptr - Pointer to a native Ansi buffer (typically returned from stringToPointerAnsi) containing a null-terminated Ansi string.
stringbuf - string buffer to be initialized
Returns:
The input string buffer.

ptrToStringBufferUni

public static StringBuffer ptrToStringBufferUni(int ptr,
                                                StringBuffer stringbuf)
Set the contents of a StringBuffer from a native Unicode buffer.
Parameters:
ptr - Pointer to a native buffer (typically returned from stringToPointerUni) containing a null-terminated Unicodestring.
stringbuf - string buffer to be initialized
Returns:
The input string buffer.

fillArray

public static void fillArray(byte[] jarray,
                             int pmem)
Fill a java array of bytes from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(char[] jarray,
                             int pmem)
Fill a java array of char's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(short[] jarray,
                             int pmem)
Fill a java array of short's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(int[] jarray,
                             int pmem)
Fill a java array of int's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(long[] jarray,
                             int pmem)
Fill a java array of long's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(float[] jarray,
                             int pmem)
Fill a java array of float's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

fillArray

public static void fillArray(double[] jarray,
                             int pmem)
Fill a java array of double's from a native memory buffer.
Parameters:
jarray - The source Java array.
pmem - pointer to the native memory buffer to receive the data from the Java array. The native array must be large enough to receive all elements of the Java array

getPointer

public static int getPointer(byte[] jarray)
Return a native buffer containing the contents of a Java byte array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(char[] jarray)
Return a native buffer containing the contents of a Java char array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(short[] jarray)
Return a native buffer containing the contents of a Java short array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(int[] jarray)
Return a native buffer containing the contents of a Java ing array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(long[] jarray)
Return a native buffer containing the contents of a Java long array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(float[] jarray)
Return a native buffer containing the contents of a Java float array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

getPointer

public static int getPointer(double[] jarray)
Return a native buffer containing the contents of a Java double array.
Parameters:
jarray - The source Java array.
Returns:
pmem pointer to the native memory buffer. The buffer will be allocated large enough to to receive the data from the Java array.

copy

public static void copy(byte[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java byte array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(char[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java char array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(short[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java short array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(int[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java int array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(long[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java long array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(float[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java float array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(double[] jarray,
                        int idx,
                        int pmem,
                        int nelems)
Copy data from a Java double array to a native buffer.
Parameters:
jarray - The source Java array.
idx - The index of the first element in 'jarray' to be copied
pmem - The pointer to the Native memory buffer. The buffer must have been allocated large enough to receive all of the elements.
nelems - The number of elements to be copied from the source Java array

copy

public static void copy(int pmem,
                        byte[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of byte's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        char[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of char's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        short[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of short's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        int[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of int's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        long[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of long's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        float[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of float's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

copy

public static void copy(int pmem,
                        double[] jarray,
                        int idx,
                        int nelems)
Copy data to a Java array of double's from a native memory buffer.
Parameters:
pmem - pointer to the source native memory buffer
jarray - The destination Java array.
idx - The index of the first element in 'jarray' to be filled
nelems - The number of elements to be copied to the destination Java array

SilverStream
Application Server 3.5