Is it possible to decode java objects in python? I know the structure of the java class that returns the data. The data is returned with the header of 'Transfer-Encoding: chunked'

Or do I need to get the return data sent as xml / json?

This is an example of the response I get;

(Note some of the control characters are removed by pasting)

-- response --

200 OK

Server: Apache-Coyote/1.1

Transfer-Encoding: chunked

Date: Tue, 22 Nov 2011 13:24:41 GMT

��srjava.util.ArrayListx����a�IsizexpGwXsr,com.blah.blah.data.ClientInfos����8d�LdbNametLjava/lang/String;Ldescriptionq~xptdbname1t Customername1q~tdbname2tCustomername2sq~t

This example returns two clients in the format of client, databasename

dbname1,customername1

dbname2,customername2

解决方案

--- Edited as more details became available ---

The content of this HTTP response is a serialized Java object.

Java serialization is a process by which an in-memory object gets packed into transport-friendly bytes for the purpose of being read by another JVM. In short, you need to read the serialization format. Assuming that they didn't add a custom serializer, the actual protocol is documented here.

The rest is just assuring that you do a sensible Java to Python mapping of the data fields. If you want to support "round trip" data handling, you should cache the sometimes discarded "java information" in special "areas" of your data structure so you can serialize back to the same java constructs.

--- Original Post follows ---

Either you are disassembling a class (which is easy to do as Java has a very rigid class structure and an easy to reverse byte code to source code mapping) or you are processing data.

If it is processing data, you're not really decoding Java, and the ease of doing what you want depends heavily on the ability to gather knowledge about how the data is encoded. Since you mentioned a "Transfer-Encoding: Chunked" header, I am guessing you are reading a HTTP response (complete with headers).

Nearly every language has a library to handle HTTP responses due to the popularity of web services. Python already has a HTTP client as indicated here.

python能解密java的,在python中解码Java对象相关推荐

  1. python加密解密库openssl_OpenSSL和Python实现RSA Key公钥加密私钥解密

    基于非对称算法的RSA Key主要有两个用途,数字签名和验证(私钥签名,公钥验证),以及非对称加解密(公钥加密,私钥解密).本文提供一个基于OpenSSL和Python进行非对称加解密的例子. 1. ...

  2. python 可迭代对象是什么_python中可迭代对象指的是什么

    python中可迭代对象指的是什么 发布时间:2020-07-20 11:19:38 来源:亿速云 阅读:91 作者:清晨 小编给大家分享一下python中可迭代对象指的是什么,相信大部分人都还不怎么 ...

  3. linux收缩java位置,找到linux中当前java的安装位置

    先看java -version $java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111 ...

  4. eclipse java 7_在Eclipse中编程Java 7

    我安装了JDK 7和Eclipse 3.6M6.然后,我将JRE 7添加为Eclipse中的新JRE执行环境,并将编译器的遵从性级别设置为Java7.我可以使用javacJDK 7随附的命令行通过命令 ...

  5. 【开发环境】Android 命令行中执行 Java 程序 ( IntelliJ IDEA 中创建 Java / Kotlin 工程 | dx 打包 DEX 字节码文件 | dalvikvm 命令 )

    文章目录 前言 一.IntelliJ IDEA 中创建 Java / Kotlin 工程 二.准备 Java 和 Kotlin 代码 三.编译在 PC 上可执行的 Java / Kotlin JAR ...

  6. java基础—TreeSet集合中储存自定义对象(java集合二)

    TreeSet集合中储存学生对象,按照其年龄进行排序 TreeSet对元素进行排序的方式一: 让元素自身具备比较功能,元素就需要实现Comparable接口,覆盖compareTo方法. TreeSe ...

  7. java钟使用dwr_DWR中各种java方法的调用

    DWR是一个框架,简单的说就是能够在javascript直接调用java方法,而不必去写一大堆的javascript代码.它的实现是基于ajax的,可以实现无刷新效果. 网上有不少DWR的例子,但大都 ...

  8. matlab怎么做到使用java,如何在Matlab中使用java.nio?

    我的目标是检查在网络上的文件夹中是否找到具有特定名称(名称的一部分)的文件,同时还要考虑其下的所有文件夹.为此,我需要一种有效获取给定文件夹内和下的所有文件和文件夹的列表的方法.我的递归函数在本地驱动 ...

  9. java jdt_在JDT中使用Java 8 Lambda

    java jdt 旧 Curmudgeon 认识Smalltalk的Dude 在修改Eclipse Java开发工具 (JDT)项目正在开发的Java 8支持时,我一直在使用这种语言. 我承认我对Ja ...

最新文章

  1. 黄聪: bootstrap 多模态框实现
  2. 通过外部表改进一个繁琐的大查询
  3. springmvc拦截器无法拦截jsp
  4. 【学习笔记】求解简单递归式的一般方法
  5. mongodb shell基础命令
  6. modprobe:用于向内核中加载模块或者从内核中移除模块
  7. windows.h有哪些函数
  8. java将ascii数组转成unicode字串
  9. codeforces 264 B. Good Sequences(dp+数学的一点思想)
  10. 什么都没学到,记录一个鼠标监听事件吧
  11. python学习手册四版中文_Python学习手册(第4版) 中文版.pdf 全文免费
  12. oracle数据库管理和日常维护,oracle数据库管理与维护
  13. 黑苹果macOS Catalina 10.15.4 安装过程详细记录
  14. 母婴群如何引流?孕妈群如何引流?母婴群怎么运营好?
  15. From.List用法详解
  16. windows gitbub使用
  17. springboot使用logback
  18. 金属学复习【3】 --- 二元合金相图和合金的凝固
  19. 排列组合算法(全排列、全组合)
  20. IDC许可证是什么证?IDC办理条件及材料

热门文章

  1. 2021年的疫情下的智能车竞赛
  2. DG8SAQ 矢量网络分析
  3. 天高任鸟飞,海阔凭鱼跃
  4. Python几个函数的の测试
  5. python中calendar怎么用_Python时间模块datetime、time、calendar的使用方法
  6. mongo 改字段名_一日一技:修改MongoDB集合中的字段名
  7. c语言逻辑运算类指令,组成原理第二章——计算机指令
  8. java 是否含有日文_《JAVA编程思想》5分钟速成:第9章(接口)
  9. java中return提醒不兼容的,奇怪的錯誤。不兼容類型錯誤行「return mFragmentList.get(position);」...
  10. bigdecimal正确用法_BigDecimal用法详解