dongpu2727 2013-03-22 14:02
浏览 47
已采纳

用PHP填充Flash CompressionAlgorithm.DEFLATE ByteArray

I'm trying to inflate Flash compressed buffer in PHP.

Here is what I have in Flex ActionScript:

var comp:ByteArray = new ByteArray();
comp.writeObject(buffer);
comp.compress(CompressionAlgorithm.DEFLATE);
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
request.contentType = contentType;
request.data = comp;
loader.load(request);

The contents of comp will be uploaded to the server in the form of post data. A php script will inflate it:

$contents = gzinflate(file_get_contents($file));

The problem is that this way, the contents of $contents is not identical to buffer. It did inflate, but it always add 4 additional bytes. For instance, 32000 bytes became 32004 bytes. I'm not sure if it's the beginning or the end.

Is there any documentation on what this 4 bytes is about, and how should I inflate this data in php? Thank you.

  • 写回答

1条回答 默认 最新

  • dsn46282 2013-03-23 03:22
    关注

    It turns out that the magic letters are 0C 83 F4 01 . And these 4 bytes are added in the beginning of uncompressed data. I can't find any documentation on this. But by removing these 4 bytes from the beginning of each ByteArray, I can get the original data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算