Forum: JRuby java_send with Java Array Parameter Type?

486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-05-09 01:09
(Received via mailing list)
All -

I'm trying to use java_send to call a Java class constructor that takes
a
byte array as its sole parameter.  How do I specify the byte array?

My best guess is:

Message.java_send(:new, [Java::Lbyte], byte_data)

...but I get this error:

     TypeError:
       cannot convert instance of class org.jruby.RubyModule to class
java.lang.Class

Thanks,
Keith
486ca04f06d968004643ce5b47376ded?d=identicon&s=25 Keith B. (keith_b)
on 2013-05-09 01:36
(Received via mailing list)
I found out that I could get the Java class of a byte array with:

java.lang.Class.forName('[B')

- Keith
6621e2fb37ab6f7c3a2b53103f83b41a?d=identicon&s=25 Michael Hall (Guest)
on 2013-05-09 02:12
(Received via mailing list)
On May 8, 2013, at 6:34 PM, Keith Bennett wrote:

> I found out that I could get the Java class of a byte array with:
>
> java.lang.Class.forName('[B')
>

System.out.println(byte[].class);
class [B

gets you there too. Theres the TYPE field for some primitive types but
I'm not remembering exactly how that works and if it applies to arrays.

Michael Hall

trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz

HalfPipe Java 6/7 shell app
http://www195.pair.com/mik3hall/index.html#halfpipe

AppConverter convert Apple jvm to openjdk apps
http://www195.pair.com/mik3hall/index.html#appconverter
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.