简体   繁体   English

J8583 LLLLBIN和LLLLVAR产生不同的长度填充结果

[英]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.

相关问题 Kotlin中的同一个程序与Python中的同一个程序会产生不同的结果 - Same program in Kotlin produces different result with the one in Python Java / Kotlin AES-128-CBC加密产生的结果与OpenSSL不同 - Java/Kotlin AES-128-CBC encryption produces different result than OpenSSL println()产生不同的输出 - println() produces different output 为什么从顶部填充根据元素的 alignment 获得不同的长度值? - why padding from top gets different length value based on element's alignment? 将ByteArray转换为字符串然后返回会产生不同的字符串 - Converting ByteArray to string and back produces different string 为什么“窗口化”的结果不同? - why is the result of “windowed” different? Tensorflow.lite model 在 Android 应用程序中产生错误(不同)结果? - Tensorflow.lite model produces wrong (different) results in Android app? 手机和布局的不同结果 - Different Result in phone and Layout 如何在kotlin中组合两个不同长度的列表? - How to combine two different length lists in kotlin? 将协程上下文显式传递给异步调用会产生不同的异常处理行为与将其安装在封闭的 scope 中 - Explicitly passing a coroutine context to an async call produces different exception handling behavior vs. installing it in the enclosing scope
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM