Hi, ABCL
I already know how to declare a jconstructor or jmethod which has primitives as arguments:
For example, for java.net.DatagramSocket, I have following declarations which works fine:
(defvar $*int (jclass "int")) (defvar $*DatagramSocket (jclass "java.net.DatagramSocket")) (defvar $*InetAddress (jclass "java.net.InetAddress"))
(defvar $%DatagramSocket/2 (jconstructor $*DatagramSocket $*int $*InetAddress)) (defvar $@close/DatagramSocket/0 (jmethod $*DatagramSocket "close")) ...
But how can I declare java.net.DatagramPacket, whose constructor has a byte[] argument:
public DatagramPacket (byte[] buf, int offset, int length)
Just don't know how to represent "byte[]" ...
Regards,
Chun Tian (binghe)
On Mon, Sep 13, 2010 at 9:02 PM, Chun Tian (binghe) binghe.lisp@gmail.com wrote:
But how can I declare java.net.DatagramPacket, whose constructor has a byte[] argument:
public DatagramPacket (byte[] buf, int offset, int length)
Just don't know how to represent "byte[]" ...
(jconstructor "java.net.DatagramPacket" "[B" "int" "int")
Hi, David
Thanks very much! (but that's really weird ...)
--binghe
在 2010-9-14,12:12, David Kirkman 写道:
On Mon, Sep 13, 2010 at 9:02 PM, Chun Tian (binghe) binghe.lisp@gmail.com wrote:
But how can I declare java.net.DatagramPacket, whose constructor has a byte[] argument:
public DatagramPacket (byte[] buf, int offset, int length)
Just don't know how to represent "byte[]" ...
(jconstructor "java.net.DatagramPacket" "[B" "int" "int")
2010/9/14 Chun Tian (binghe) binghe.lisp@gmail.com:
Hi, David
Thanks very much! (but that's really weird ...)
AFAIK, that "[B" is what you'd have to pass to Class.forName in Java to get the class representing byte[], so the weirdness/ugliness comes from there ;) Alternatively, you can obtain the same class as (jclass-of (jnew-array "byte" 0)), and define that as a constant.
armedbear-devel@common-lisp.net