Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

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.

The 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+.

Compatibility Warning: object transformer

As of version 0.2.0, the notion of object transformer from the original project as been replaced by an object creator.

The object creator is called before the deserialization. This allows to store the reference of the converted object before deserializing it, and avoids a mismatch between the referenced object and the transformed one.

Compatibility Warning: bytes arrays

As of version 0.2.3, bytes arrays are loaded as a bytes object instead of an array of integers.

Features

  • Java object instance unmarshaling
  • Java classes unmarshaling
  • Primitive values unmarshaling
  • Automatic conversion of Java Collections to python ones (HashMap => dict, ArrayList => list, etc.)
  • Basic marshalling of simple Java objects

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()
Release History

Release History

This version
History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
javaobj_py3-0.2.3-py2.py3-none-any.whl (16.0 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Nov 15, 2016
javaobj-py3-0.2.3.tar.gz (14.3 kB) Copy SHA256 Checksum SHA256 Source Nov 15, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting