Skip to content

Commit 8f64133

Browse files
vbuellYour New Committer Name
authored andcommitted
README added
1 parent 9cd7286 commit 8f64133

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
```

0 commit comments

Comments
 (0)