June 2002
Beginner to intermediate
640 pages
14h 24m
English
ObjectOutputStream writes out Java class instances (objects) to an output stream. It accomplishes for Java what the pickle module does for Python. Only Java instances that have the Serializable class (interface) as a base class (interface) can be serialized with ObjectOutputStream. All Jython objects (class instances, functions, dictionaries, lists) implement Serializable.
Here's a short example. Import ObjectOutputStream and FileOutputStream from the java.io package.
>>> from java.io import ObjectOutputStream, FileOutputStream
Create an instance of ObjectOutputStream, passing the constructor a new instance of FileOutputStream.
>>> oos = ObjectOutputStream(FileOutputStream("c:\\dat\\out.bin"))
Define a ...
Read now
Unlock full access