How should I create an instance of type [java]fanx.interop::CharArray?
brianFri 16 Jul 2021
You just treat it like a class:
CharArray(10)
Will get compiled into
new char[10]
CarlosFri 16 Jul 2021
I see. But how do I get it initialized?
I'm trying to instantiate a Java class that has a couple of constructors with the folowing signatures:
ZipFile(String)
ZipFile(String, char[])
I have no problem using the first constructor, but I need to use the second one and I can't make it to work. I have the value for the 2nd argument (the char[] one) stored in a Fantom's Str var and I need to convert it to a CharArray.
How should I do it?
brianFri 16 Jul 2021
I would just use an explicit loop to convert a Fantom Str to a Java char[] as follows:
Carlos Fri 16 Jul 2021
How should I create an instance of type
[java]fanx.interop::CharArray
?brian Fri 16 Jul 2021
You just treat it like a class:
Will get compiled into
Carlos Fri 16 Jul 2021
I see. But how do I get it initialized?
I'm trying to instantiate a Java class that has a couple of constructors with the folowing signatures:
I have no problem using the first constructor, but I need to use the second one and I can't make it to work. I have the value for the 2nd argument (the
char[]
one) stored in a Fantom'sStr
var and I need to convert it to aCharArray
.How should I do it?
brian Fri 16 Jul 2021
I would just use an explicit loop to convert a Fantom Str to a Java char[] as follows:
There is a String.toCharArray however not accessible thru the Fantom Java FFI the way things work.
Carlos Fri 16 Jul 2021
I did it in that way. Thanks Brian!