[英]J8583 LLLLBIN and LLLLVAR produces the different length padding result
LLLLVAR and LLLLBIN produces different length produced from the same input. LLLLVAR和LLLLBIN从相同的输入产生不同的长度。
Tried to pass in the value "6832" into the same IsoMessage object, however, LLLLVAR returns " 0004 6382", while LLLLBIN returns " 0008 36333832". 试图将值“ 6832”传递到同一IsoMessage对象中,但是LLLLVAR返回“ 0004 6382”,而LLLLBIN返回“ 0008 36333832”。
Sample of the source code as below: 源代码示例如下:
msg.setValue(60, "6832".toByteArray(Charsets.US_ASCII), IsoType.LLLLBIN, 10)//encodes to 000836333832
msg.setValue(60, "6832", IsoType.LLLLVAR, 10) //encodes to 00046382
I though both should return 0004, why are both results different? 我虽然都应该返回0004,但为什么结果都不同?
When you encode ISO messages as text, the LxBIN fields encode their data in hex, and so the size is double what you'd expect. 当您将ISO消息编码为文本时,LxBIN字段将其数据编码为十六进制,因此大小是您期望的两倍。 However, the decoder decodes the hex data and gives you a byte array when parsing.
但是,解码器会解码十六进制数据,并在解析时为您提供字节数组。
LxVAR and LxBIN fields only have the same length when the whole message is encoded using binary formatting. 仅当使用二进制格式对整个消息进行编码时,LxVAR和LxBIN字段的长度相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.