File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ # python-javaobj
2+
3+ python-javaobj is a python library that provides functions for reading and writing (writing is WIP currently) Java objects
4+ serialized or will be deserialized by !ObjectOutputStream. This form of object
5+ representation is a standard data interchange format in Java world.
6+
7+ javaobj module exposes an API familiar to users of the standard library marshal, pickle and json modules.
8+
9+ ## Features
10+
11+ * Java object instance unmarshaling
12+ * Java classes unmarshaling
13+ * Primitive values unmarshaling
14+ * Automatic conversion of Java Collections to python ones (!HashMap => dict, !ArrayList => list, etc)
15+
16+ ## Requirements
17+
18+ * Python >= 2.6, but < 3.0 (porting to 3.0 is in progress)
19+ * Maven 2+ (for building test data of serialized objects. You can skip it if you do not plan to run tests.py)
20+
21+ ## Usage
22+
23+ Unmarshalling of Java serialised object:
24+
25+ ``` python
26+ import javaobj
27+
28+ jobj = self .read_file(" obj5.ser" )
29+ pobj = javaobj.loads(jobj)
30+ print pobj
31+ ```
32+
33+ Or, you can use Unmarshaller object directly:
34+
35+ ``` python
36+ import javaobj
37+
38+ marshaller = javaobj.JavaObjectUnmarshaller(open (" sunExample.ser" ))
39+ pobj = marshaller.readObject()
40+
41+ self .assertEqual(pobj.value, 17 )
42+ self .assertTrue(pobj.next)
43+
44+ pobj = marshaller.readObject()
45+ ```
You can’t perform that action at this time.
0 commit comments