primitive-array-to-lisp-array p-array &key start end target-start target-end lisp-array => l-result
lisp-array-to-primitive-array l-array &key start end target-start target-end primitive-array => p-result
A Java array of primitive type.
Bounding index designators.
A Lisp array of an acceptable type, or nil
.
A Lisp array of an acceptable type.
A Java array of primitive type, or nil
.
The function primitive-array-to-lisp-array
takes a Java array p-array of primitive type and copies elements from it to a Lisp array of matching type. The target lisp-array is created by default, but can also be supplied as an argument.
The function lisp-array-to-primitive-array
takes a Lisp array l-array of an acceptable Lisp type and copies elements from it to a Java array of matching type. The target primitive-array is created by default, but can also be supplied as an argument.
start and end are bounding index designators for the source p-array or l-array, specifying the range to copy.
target-start and target-end are used only if the target is supplied (by lisp-array or primitive-array). They specify the start and end for copying in the target. The actual number of elements copied is the minimum of the lengths specified for the source and for the target.
If the target (lisp-array or primitive-array) is not supplied, these functions create an array of the correct type and the copy length, and copy into it.
The Lisp array that is passed to lisp-array-to-primitive-array
must be of one of the types listed below, and when the target array is supplied, its type must match the type of the source array according to the table below, except that cl:base-char
array (cl:simple-base-string
) is acceptable when the Java side is byte
.
Keyword |
||
---|---|---|
For a large number of elements, these functions are much faster than jvref. If the primitive data is needed for passing to or from foreign functions, use get-primitive-array-region and set-primitive-array-region instead. These functions work only on arrays with one dimension with primitive element type. For non-primitive arrays of one dimension you can use map-java-object-array.
get-primitive-array-region
set-primitive-array-region
map-java-object-array
jvref
jaref
Working with Java arrays
LispWorks User Guide and Reference Manual - 20 Sep 2017