Module for serializing and de-serializing Java objects.
Project description
python-javaobj is a python library that provides functions for reading and writing (writing is WIP currently) Java objects serialized or will be deserialized by _ObjectOutputStream_. This form of object representation is a standard data interchange format in Java world.
javaobj module exposes an API familiar to users of the standard library marshal, pickle and json modules.
About this repository
This project is a fork of python-javaobj by Volodymyr Buell, originally from Google Code and now hosted on GitHub.
This fork intends to work both on Python 2.7 and Python 3.2+.
Features
Java object instance unmarshaling
Java classes unmarshaling
Primitive values unmarshaling
Automatic conversion of Java Collections to python ones (_HashMap_ => dict, _ArrayList_ => list, etc)
Requirements
Python >= 2.7 or Python >= 3.2
Maven 2+ (for building test data of serialized objects. You can skip it if you do not plan to run tests.py)
Usage
Unmarshalling of Java serialised object:
import javaobj
jobj = self.read_file("obj5.ser")
pobj = javaobj.loads(jobj)
print(pobj)
Or, you can use Unmarshaller object directly:
import javaobj
marshaller = javaobj.JavaObjectUnmarshaller(open("objCollections.ser"))
pobj = marshaller.readObject()
self.assertEqual(pobj.value, 17)
self.assertTrue(pobj.next)
pobj = marshaller.readObject()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file javaobj-py3-0.1.4.zip
.
File metadata
- Download URL: javaobj-py3-0.1.4.zip
- Upload date:
- Size: 16.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91235dac4791534e8c40e6967cfd705bd67954950ab397e4ae2b964fcd2dcbe |
|
MD5 | ae0a194c3a7e10a3239fc0e55919d32f |
|
BLAKE2b-256 | 7e7146d0ab57bed696be911c850308d2a6d19536a3624050e083d685e5040499 |
File details
Details for the file javaobj_py3-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: javaobj_py3-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a956964f94941e530ea2f849abbaab22d5ff861a8604397966458d667fb79cb |
|
MD5 | a992006e226432a5d6520a7a9a1f59d4 |
|
BLAKE2b-256 | 7c5ed0397c97988781f9f37630a3d8d811e5f7cd6164c8bc2a90a7ff009df2d0 |