java – 解析包含未知长度字段的字节数组
发布时间:2020-12-14 23:35:43 所属栏目:Java 来源:网络整理
导读:我在 Java中解析一个具有以下规范的字节数组: Trace data format: - 4 bytes containing the Id. - 4 bytes containing the address. - N bytes containing the first name,where 0 N 32 - N bytes containing the last name,where 0 N 32 - 4 bytes contai
我在
Java中解析一个具有以下规范的字节数组:
Trace data format: - 4 bytes containing the Id. - 4 bytes containing the address. - N bytes containing the first name,where 0 < N < 32 - N bytes containing the last name,where 0 < N < 32 - 4 bytes containing the Minimum - 4 bytes containing the Maximum - 4 bytes containing the Resource Default Level 今天我没有看到解析这个数组的任何解决方案,以获得具有正确类型的7变量.你确认或者我错过了Java中的魔术函数,允许在字节数组中找到字符串“限制”(我无法看到最小值如何与其关联的ASCII字符区分开来). 关于2个字符串之间的特殊字符是否有任何“约定”? 解决方法
好吧,你知道第一个名字从字节9开始,而姓氏以字节结尾(lenght-13).不确定的是如何找到名字的结尾和姓氏的开头.我看到一些可能的消息:
>如果格式是由C程序员定义的,则两个名称字段很可能以空字节终止,因为这是字符串的C约定. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |