[armedbear-devel] How to use JARRAY-SET to fill a byte array?

Chun Tian (binghe) binghe.lisp at gmail.com
Tue Sep 14 06:45:14 UTC 2010

Hi again ... ABCL

I want to fill a Java byte[] array. But I don't know how to correctly use JARRAY-SET (I should use it, right?):

CL-USER(1): (defvar $*byte (jclass "byte"))
CL-USER(2): (setf array (jnew-array $*byte 10))
#<jarray [B at 7a2ee7e5 {1D7AAA0E}>
CL-USER(3): (jarray-set array 1 0)
#<THREAD "interpreter" {6E61A414}>: Debugger invoked on condition of type JAVA-EXCEPTION
  Java exception 'java.lang.IllegalArgumentException: argument type mismatch'.
  0: TOP-LEVEL Return to top level.
[1] CL-USER(4): 0
CL-USER(5): (jarray-ref array 0)

So, a plain number "1" cannot work, but what else I can do? a object of java.lang.Byte?

And, is there any quick way I can fill a byte array using contents from a Lisp array?


Chun Tian (binghe)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2603 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20100914/57960b35/attachment.bin>

More information about the armedbear-devel mailing list