Reputation: 2225
I have a java object which I retrieve using a HTTP request. How can I 'un-serialize' the java data in jython?
Upvotes: 2
Views: 1530
Reputation: 2167
You just call the java methods to deserialize from Jython.
Looks like you have to create an ObjectInputStream from your InputStream and then call readObject on it. Something like:
import java.io
jobj = java.io.ObjectInputStream( httpinputstream ).readObject()
You already got an answer to this in this previous question.
If you want a more detailed answer, you need to provide details. Where is your HTTP request coming from ? an HttpURLConnection ?
Upvotes: 2
Reputation: 18850
I guess the project python-javaobj is what you are looking for.
Alternatively you could perhaps consider using another, simpler format for serializing objects like JSON... ?!
Upvotes: 2