简体   繁体   English

LZ4库兼容性问题:java和IOS

[英]LZ4 library compatibility Issue: java and IOS

I want to compress data with LZ4 at IOS end and want to decompress the same at Java end. 我想在IOS端使用LZ4压缩数据,并想在Java端解压缩数据。

I used LZ4 compression with stream compression method for IOS and jpountz () for Java. 对于IOS,我将LZ4压缩流压缩方法结合使用 ,对于Java,我使用了jpountz ()。

It failed at Java end while decompressing. 解压缩时在Java端失败。 (Looks like LZ4 header is different for both platform.) (看起来LZ4标头在两个平台上都不同。)

Please help! 请帮忙!

If not possible, can you please recommend any interoperable LZ4 lib for JAVA and IOS? 如果不可能,请为Java和IOS建议任何可互操作的LZ4库吗?

LZ4 for IOS and from jpountz both encapsulate data using their own headers. 用于IOS的LZ4和来自jpountz的LZ4都使用自己的标头封装数据。 Since these headers are different, they can't read each other. 由于这些标头不同,因此它们不能互相读取。

You will have to understand each header format, and implement some form of translation layer between the two. 您将必须了解每种标题格式,并在两者之间实现某种形式的翻译层。 Once the headers are fixed, the rest of the payload (the compressed data itself) should be readable. 标头固定后,其余的有效负载(压缩数据本身)应可读。

Another possibility is to use different LZ4 libraries, compliant with the official LZ4 frame format . 另一种可能性是使用与官方LZ4帧格式兼容的其他LZ4库。 The LZ4 homepage maintains a list of compliant codecs , one of which is a Java version. LZ4主页维护一个兼容的编解码器列表 ,其中一个是Java版本。

The C reference version can be used on iOS. C参考版本可以在iOS上使用。 It's portable, and generally compatible with Objective-C. 它是便携式的,并且通常与Objective-C兼容。 Use lz4frame.h for encapsulation using the official frame format. 使用lz4frame.h使用官方框架格式进行封装。

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

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