【发布时间】:2025-12-13 12:00:01
【问题描述】:
我有一个接受这个作为有效负载的网络服务:
{
"MTI": "0100",
"2": "4655206331051889",
"3": "000000",
"4": "000000012300",
"7": "0321054133",
"11": "001205",
"14": "0325",
"18": "5399",
"22": "022",
"25": "00",
"35": "2312312332",
"37": "206305000014",
"41": "29110001",
"42": "1001001",
"49": "840",
"transactionid": "12",
"co-ordinates": "3042304,293572945"
}
这是打包并生成 iso 消息表示的代码:
for (Map.Entry<Object, Object> entry : attributes.entrySet()) {
if (entry.getKey().equals("transactionid")) {
msg.set(6, entry.getValue().toString());
} else if (entry.getKey().equals("MTI")) {
msg.setMTI(entry.getValue().toString());
} else if (entry.getKey().equals("co-ordinates")) {
String[] coordinates = entry.getValue().toString().split(",");
msg.set(57, coordinates[0]);
msg.set(58, coordinates[1]);
} else msg.set(Integer.parseInt(entry.getKey().toString()), entry.getValue().toString());
}
msg.setPackager(new ISO87BPackager());
byte[] packedMsg = msg.pack();
System.out.println(ISOUtil.hexdump(packedMsg));
这是结果:
0000 01 00 76 24 44 80 28 C0 80 C0 16 46 55 20 63 31 ..v$D.(....FU c1
0010 05 18 89 00 00 00 00 00 00 01 23 00 00 00 00 00 ..........#.....
0020 00 12 03 21 05 41 33 00 12 05 03 25 53 99 00 22 ...!.A3....%S.."
0030 00 10 23 12 31 23 32 32 30 36 33 30 35 30 30 30 ..#.1#2206305000
0040 30 31 34 32 39 31 31 30 30 30 31 31 30 30 31 30 0142911000110010
0050 30 31 20 20 20 20 20 20 20 20 38 34 30 00 07 33 01 840..3
0060 30 34 32 33 30 34 00 09 32 39 33 35 37 32 39 34 042304..29357294
0070 35 5
现在我想排除以 0000 开头的第一列和看起来像加密或类似的东西的第四列... 所以我希望最后是第二列的开始到第四列之前的结尾......
预期输出:
01007624448028C080C016465520633105188900000000000001230000000000001203210541330012050325539900220010231231233232303633303530303030313432393131303030313130303130303120202020202020203834300007333034323330340009323933353732393435
提前致谢
【问题讨论】: