Skip to main content

Module for serializing and de-serializing Java objects.

Project description

Latest Version License Travis-CI status Coveralls status

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.

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


Download files

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

Source Distribution

javaobj-py3-0.2.0.zip (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

javaobj_py3-0.2.0-py2.py3-none-any.whl (14.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file javaobj-py3-0.2.0.zip.

File metadata

  • Download URL: javaobj-py3-0.2.0.zip
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for javaobj-py3-0.2.0.zip
Algorithm Hash digest
SHA256 813ef56ceb2047229bb088a71c0a612ed26ae603f90e9a94fdc493a392cbfe2b
MD5 335b372ed6db124849fbd67bebfae37c
BLAKE2b-256 b72f71df16eb359ce3ce5645dd4cb233cb187cc2fe97aa0702e5e06003229fdc

See more details on using hashes here.

File details

Details for the file javaobj_py3-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for javaobj_py3-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b3162c51ed990fdd40adc78388a5684a7de7e7c6d9cafa62c3c70244aa825521
MD5 abf696b323db44a61eded7b646226125
BLAKE2b-256 0eb6cb81c152a2240aa6bfc0bd5fc69650838f31151e54c0a94e5a5f78800df1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page