简体   繁体   English

目标C和C#之间的任意对象的二进制序列化?

[英]Binary serialization of arbitrary objects beween Objective C and C#?

We want to pass a forest - a dictionary with values which can be: dictionaries, arrays, sets, numbers, strings, byte buffers - between Objective C and C# efficiently (time-wise, space is a lesser concern). 我们想在目标C和C#之间高效地传递森林-字典,其值可以是:字典,数组,集合,数字,字符串,字节缓冲区-(在时间上,较少关注空间)。 Google's Protocol Buffers looked good, but they seem to handle only structured data, while ours is arbitrary. Google的Protocol Buffer看起来不错,但它们似乎只能处理结构化数据,而我们的是任意的。 Ultimately we can write a binary (de)serialiser ourselves, but surely this was done before and released as FOSS somewhere? 最终,我们可以自己编写一个二进制(反)序列化器,但是可以肯定的是,这是以前完成的,并以FOSS的形式发布在某个地方?

Have you considered using ASN.1? 您是否考虑过使用ASN.1? Since ASN.1 is independent of programing language or system architecture, it can be used efficiently regardless of whether you need C, C#, C++, or Java. 由于ASN.1独立于编程语言或系统体系结构,因此无论您是否需要C,C#,C ++或Java,都可以有效地使用它。

You create a description of the information you wish to exchange, and the use an ASN.1 tool to generate an encoder/decoder for your target programming language. 您创建要交换的信息的描述,并使用ASN.1工具生成目标编程语言的编码器/解码器。 ASN.1 also supports a few different rules for transmitting the date which range from the efficient PER (Packed Encoding Rules) to the verbose, but flexible XER (XML Encoding Rules). ASN.1还支持一些不同的规则来传输日期,范围从有效的PER(打包编码规则)到冗长但灵活的XER(XML编码规则)。

To play with ASN.1 to see if this might work for you, try the free online ASN.1 compiler and encoder/decoder at http://asn1-playground.oss.com to see if this might work for you. 要使用ASN.1来查看是否适合您,请尝试免费的在线ASN.1编译器和编码器/解码器,网址为http://asn1-playground.oss.com,以查看是否适合您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM