[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46200] octave automatically converts java str
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #46200] octave automatically converts java strings into char arrays |
Date: |
Tue, 13 Oct 2015 15:29:15 +0000 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1) |
Follow-up Comment #1, bug #46200 (project octave):
Need someone with Matlab and some tests cases. I think there may be a
distinction between returning the generic javaObject class, which then gets
queried by Matlab and converted if necessary, and returning a specific object
from a given class.
Otherwise, you it would be next to impossible to actually create a
java.lang.String object because it would always be auto-converted.
As an example, what does Matlab do for
jstr = javaObject ('java.lang.String', 'Hello World')
isjava (jstr)
My guess is that this remains an object, not converted to char.
On the other hand, the following code does do auto-conversion. Presumably,
because a Java array is an array of the generic java.lang.Object type
octave:17> jarr = javaArray ('java.lang.String', 2,2)
jarr =
<Java object: java.lang.String[][]>
octave:18> jarr(1,2) = 'hello world'
jarr =
<Java object: java.lang.String[][]>
octave:19> % Now index into array
octave:19> jarr(1,2)
ans = hello world
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46200>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/