有没有办法通过 python 反序列化 java 对象

Is there a way to deserialize the java object via python

我将 java 对象存储在 hbase 中(即)假设我有一个对象 'User',它有 3 个参数,如名字、中间名和姓氏。我在 java

中使用了以下代码进行序列化
Object object = (object) user;    
byte[] byteData = SerializationUtils.serialize((Serializable) object);

并像 'storing complete object (in byte[] format of above) in the Value portion of the KeyValue pair'

一样存储在 hbase 中

它像(示例)一样存储在 hbase 中

column=container:container, timestamp=1480016194005, value=\xAC\xED\x00\x05sr\x00&com.test.container\x07\x89\x83\xFA\x7F\xD0F\xA5\x02\x00\x08I\x00\x07classIdJ\x00\x14dateTimeInLongFormatZ\x00\x04rootZ\x00\x09undefinedL\x00\x03keyt\x00\x12Ljava/lang/String;L\x00\x04modeq\x00~\x00\x01L\x00\x04nameq\x00~\x00\x01L\x00\x06userIdq\x00~\x00\x01xp\x00\x00\x00\x02\x00\x00\x01X\x967\xBA\xF0\x00\x00t\x00\x1Econtainer_393_5639181044834024t\x00\x06expandt\x00\x02ert\x00\x08testadmin

当我尝试检索数据时,我在 java 中使用了以下反序列化并转换回可读格式的对象

对象=SerializationUtils.deserialize(字节);

I would like to retrieve the data stored in java format via happybase using python and I achieved it and received the data as available in hbase like

它像(示例)一样存储在 hbase 中

column=container:container, timestamp=1480016194005, value=\xAC\xED\x00\x05sr\x00&com.test.container\x07\x89\x83\xFA\x7F\xD0F\xA5\x02\x00\x08I\x00\x07classIdJ\x00\x14dateTimeInLongFormatZ\x00\x04rootZ\x00\x09undefinedL\x00\x03keyt\x00\x12Ljava/lang/String;L\x00\x04modeq\x00~\x00\x01L\x00\x04nameq\x00~\x00\x01L\x00\x06userIdq\x00~\x00\x01xp\x00\x00\x00\x02\x00\x00\x01X\x967\xBA\xF0\x00\x00t\x00\x1Econtainer_393_5639181044834024t\x00\x06expandt\x00\x02ert\x00\x08testadmin

有没有办法通过 python

反序列化 java 对象

非常感谢

哈里

有一个 Python 库:

https://pypi.python.org/pypi/javaobj-py3/

用法似乎很简单:

import javaobj
jobj = self.read_file("obj5.ser")
pobj = javaobj.loads(jobj)
print(pobj)