octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #42112] Unable to load Java objects from MAT f


From: Rik
Subject: [Octave-bug-tracker] [bug #42112] Unable to load Java objects from MAT file
Date: Thu, 01 May 2014 22:28:56 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0

Follow-up Comment #5, bug #42112 (project octave):

Just for fun I tried to see if I could load and save Java objects using Java's
Serializable methods.  It worked fine.  It would be nice to have Octave
implement this for load_binary/save_binary in ov-java.cc.  I used


x = javaObject ('java.lang.Double', pi)
fout = javaObject('java.io.FileOutputStream', '/tmp/blah.ser')
sout = javaObject ('java.io.ObjectOutputStream', fout)
sout.writeObject (x)
sout.close ()
fin = javaObject('java.io.FileInputStream', '/tmp/blah.ser')
sin = javaObject ('java.io.ObjectInputStream', fin)
xin = sin.readObject
xin
sin.close ()
fin = javaObject('java.io.FileInputStream', '/tmp/blah.ser')
sin = javaObject ('java.io.ObjectInputStream', fin)
xin2 = javaObject ('java.lang.Double', sin.readObject())
xin2.toString


The first time I read the object it just returned a double of 3.1416. I think
this is probably caused by Octave auto-converting the result from a Java
object to a double. The second time I called the Java constructor with the
results of the readObject call and it returned a true Java object with the
full value of pi. 

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42112>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]