1
- # javaobj-py3
1
+ javaobj-py3
2
+ ###########
2
3
3
4
python-javaobj is a python library that provides functions for reading and
4
5
writing (writing is WIP currently) Java objects serialized or will be
@@ -8,50 +9,54 @@ standard data interchange format in Java world.
8
9
javaobj module exposes an API familiar to users of the standard library
9
10
marshal, pickle and json modules.
10
11
11
- ## About this repository
12
+ About this repository
13
+ =====================
12
14
13
15
This project is a fork of python-javaobj by Volodymyr Buell, originally from
14
- [ Google Code] ( http://code.google.com/p/python-javaobj/ ) and now hosted on
15
- [ GitHub] ( https://github.com/vbuell/python-javaobj ) .
16
+ ` Google Code < http://code.google.com/p/python-javaobj/ >`_ and now hosted on
17
+ ` GitHub < https://github.com/vbuell/python-javaobj >`_ .
16
18
17
19
This fork intends to work both on Python 2.7 and Python 3.
18
20
19
- ## Features
21
+ Features
22
+ ========
20
23
21
24
* Java object instance unmarshaling
22
25
* Java classes unmarshaling
23
26
* Primitive values unmarshaling
24
27
* Automatic conversion of Java Collections to python ones
25
28
(_HashMap_ => dict, _ArrayList_ => list, etc)
26
29
27
- ## Requirements
30
+ Requirements
31
+ ============
28
32
29
33
* Python >= 2.7 or Python >= 3.2
30
34
* Maven 2+ (for building test data of serialized objects.
31
35
You can skip it if you do not plan to run tests.py)
32
36
33
- ## Usage
37
+ Usage
38
+ =====
34
39
35
40
Unmarshalling of Java serialised object:
36
41
37
- ``` python
38
- import javaobj
42
+ .. code-block :: python
39
43
40
- jobj = self .read_file(" obj5.ser" )
41
- pobj = javaobj.loads(jobj)
42
- print pobj
43
- ```
44
+ import javaobj
45
+
46
+ jobj = self .read_file(" obj5.ser" )
47
+ pobj = javaobj.loads(jobj)
48
+ print (pobj)
44
49
45
50
Or, you can use Unmarshaller object directly:
46
51
47
- ``` python
48
- import javaobj
49
-
50
- marshaller = javaobj.JavaObjectUnmarshaller( open ( " sunExample.ser " ))
51
- pobj = marshaller.readObject( )
52
-
53
- self .assertEqual(pobj.value, 17 )
54
- self .assertTrue (pobj.next )
55
-
56
- pobj = marshaller.readObject()
57
- ```
52
+ .. code-block :: python
53
+
54
+ import javaobj
55
+
56
+ marshaller = javaobj.JavaObjectUnmarshaller( open ( " sunExample.ser " ) )
57
+ pobj = marshaller.readObject()
58
+
59
+ self .assertEqual (pobj.value, 17 )
60
+ self .assertTrue(pobj.next)
61
+
62
+ pobj = marshaller.readObject()
0 commit comments