|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sssw.rt.com.DllLib
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 |
public DllLib()
Method Detail |
public static int DLLGetHandle(String path)
path
- the absolute path of a DLLpublic static int DLLFreeHandle(int handle)
handle
- a native pointer returned by DLLGetHandleDllLib.DLLGetHandle(String path)
public static int DLLGetMethod(int handle, String methodname)
handle
- native pointer to DLL that was loaded using DLLGetHandlemethodname
- function name to be loadedDllLib.DLLGetHandle(String path)
public static int call(int pproc)
pproc
- a pointer to function obtained by calling DLLGetMethodpublic static int call(int pproc, int p1)
pproc
- a pointer to function obtained by calling DLLGetMethodp1
- argument to the function call must be converted into int
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4, int p5)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int call(int pproc, int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.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)
pproc
- a pointer to function obtained by calling DLLGetMethodpN
- arguments to the function call must be converted into ints
by using the methods in this class such as XXXToPtr, getPointer,
AllocHGlobal or AllocCoTaskMem.public static int allocHGlobal(int size)
size
- Number of bytes to allocatepublic static void freeHGlobal(int ptr)
ptr
- Native memory pointerpublic static int allocCoTaskMem(int size)
size
- Number of bytes to allocatepublic static void freeCoTaskMem(int ptr)
ptr
- Native memory pointerpublic static byte read1(int pmem, int offset)
pmem
- Native memory pointeroffset
- The offset into the memory block (in bytes) to read from.public static short read2(int pmem, int offset)
pmem
- Native pointer returned from allocHGlobal or allocCoTaskMemoffset
- The offset into the memory block (in bytes) to read from.public static int read4(int pmem, int offset)
pmem
- Native pointer returned from allocHGlobal or allocCoTaskMemoffset
- The offset into the memory block (in bytes) to read from.public static void write1(int pmem, int offset, byte value)
pmem
- Native pointer returned from allocHGlobal or allocCoTaskMemoffset
- The offset into the memory block (in bytes) where the byte is
to be writtenpublic static void write2(int pmem, int offset, short value)
pmem
- Native pointer returned from allocHGlobal or allocCoTaskMemoffset
- The offset into the memory block (in bytes) where the bytes are
to be writtenpublic static void write4(int pmem, int offset, int value)
pmem
- Native pointer returned from allocHGlobal or allocCoTaskMemoffset
- The offset into the memory block (in bytes) where the bytes are
to be writtenpublic static int stringToPtrUni(String string)
string
- The Java string to be placed into native memorypublic static int stringToPtrAnsi(String string)
string
- The Java string to be placed into native memorypublic static String ptrToStringAnsi(int ptr)
ptr
- Pointer to a native buffer (typically returned
from stringToPointerAnsi) containing a null-terminated Ansi string.public static String ptrToStringUni(int ptr)
ptr
- Pointer to a native buffer (typically returned
from stringToPointerAnsi) containing a null-terminated Unicode string.public static StringBuffer ptrToStringBufferAnsi(int ptr, StringBuffer stringbuf)
ptr
- Pointer to a native Ansi buffer (typically returned
from stringToPointerAnsi) containing a null-terminated Ansi string.stringbuf
- string buffer to be initializedpublic static StringBuffer ptrToStringBufferUni(int ptr, StringBuffer stringbuf)
ptr
- Pointer to a native buffer (typically returned
from stringToPointerUni) containing a null-terminated Unicodestring.stringbuf
- string buffer to be initializedpublic static void fillArray(byte[] jarray, int pmem)
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 arraypublic static void fillArray(char[] jarray, int pmem)
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 arraypublic static void fillArray(short[] jarray, int pmem)
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 arraypublic static void fillArray(int[] jarray, int pmem)
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 arraypublic static void fillArray(long[] jarray, int pmem)
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 arraypublic static void fillArray(float[] jarray, int pmem)
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 arraypublic static void fillArray(double[] jarray, int pmem)
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 arraypublic static int getPointer(byte[] jarray)
jarray
- The source Java array.public static int getPointer(char[] jarray)
jarray
- The source Java array.public static int getPointer(short[] jarray)
jarray
- The source Java array.public static int getPointer(int[] jarray)
jarray
- The source Java array.public static int getPointer(long[] jarray)
jarray
- The source Java array.public static int getPointer(float[] jarray)
jarray
- The source Java array.public static int getPointer(double[] jarray)
jarray
- The source Java array.public static void copy(byte[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(char[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(short[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(int[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(long[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(float[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(double[] jarray, int idx, int pmem, int nelems)
jarray
- The source Java array.idx
- The index of the first element in 'jarray' to be copiedpmem
- 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 arraypublic static void copy(int pmem, byte[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, char[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, short[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, int[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, long[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, float[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java arraypublic static void copy(int pmem, double[] jarray, int idx, int nelems)
pmem
- pointer to the source native memory bufferjarray
- The destination Java array.idx
- The index of the first element in 'jarray' to be fillednelems
- The number of elements to be copied to the destination Java array
|
SilverStream Application Server 3.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |