简体   繁体   English

在Linux中使用java.util.zip压缩SWF时出现问题

[英]Problem when compressing SWF in Linux with java.util.zip

I've created a servlet that changes the binaries of a SWF file and output it to the user. 我创建了一个Servlet,它可以更改SWF文件的二进制文件并将其输出给用户。 The SWF is compressed by ZLIB by default. 默认情况下,ZLIB压缩SWF。 Then I inflate, change the binaries, deflate and output the result. 然后,我充气,更改二进制文件,放气并输出结果。

Everything was running right on a Windows Server 2008 (also in 2003). 一切都在Windows Server 2008上运行(同样在2003年)。 Currently, we need change the server to Linux, and then, this servlet is somehow outputing a corrupted SWF File... what could be the problem? 当前,我们需要将服务器更改为Linux,然后,该servlet以某种方式输出损坏的SWF文件……可能是什么问题? What intrigues me more is that there is no difference between the Windows and Linux servlet versions. 更令我着迷的是Windows和Linux servlet版本之间没有区别。

Is there any undocumented linux specific behaviour for the java.util.zip package? java.util.zip软件包是否存在任何未公开的Linux特定行为?


My Windows Server is (where the servlet is working): 我的Windows Server(servlet在其中运行):

  • Windows Server 2008 (6.0 - x86) Windows Server 2008(6.0-x86)
  • Apache 2.2.11 阿帕奇2.2.11
  • Tomcat 6.0.16.0 Java Tomcat 6.0.16.0 Java
  • JDK 1.6.0_12-b04 JDK 1.6.0_12-b04


My CentOS Server is (where te servlet doesn't work) 我的CentOS服务器在其中(servlet无法正常工作)

  • CentOS 5.4 (2.6.18-164.15.1.el5 - i386) CentOS 5.4(2.6.18-164.15.1.el5-i386)
  • Apache 2.2.3 阿帕奇2.2.3
  • Tomcat 6.0.16.0 的Tomcat 6.0.16.0
  • Java JDK 1.6.0_12-b04 Java JDK 1.6.0_12-b04

Any lead would be appreciated! 任何线索将不胜感激! Cheers, CaioToOn! 干杯, CaioToOn!

It's difficult to say more without seeing some code and/or examples of how your SWF files are being "corrupted". 如果不看一些代码和/或SWF文件如何“损坏”的示例,很难说更多。 To answer your question directly, I can't think of any difference in principle between the zip library on the two platforms. 要直接回答您的问题,我认为这两个平台上的zip库在原理上没有任何区别。 But some things to think about: 但是要考虑一些事情:

  • things that could be different include the default character encoding (are you somewhere converting a string to bytes, which under Linux accidentally puts illegal characters into the file) -- though I admit that off the top of my head, I can't just think where this would be in your particular scenario 可能会有所不同的包括默认字符编码(您是否在某个地方将字符串转换为字节,在Linux下会意外地将非法字符放入文件中)-尽管我承认这很重要,但我不能认为在您的特定情况下
  • what other libraries are you relying on? 您还依赖其他哪些库?
  • get some logging into your servlet and see what the actual file data looks like at the various stages through the process... 在您的servlet中进行一些登录,并查看整个过程中各个阶段的实际文件数据是什么样的...
  • in a similar vein, can you elaborate on the way in which the file is "corrupted"-- what error messages do you get, if any? 同样,您可以详细说明文件“损坏”的方式吗?您会得到什么错误消息(如果有)? when you compare a "good" file and a "corrupted" file in your hex editor, what difference is there? 在十六进制编辑器中比较“好”文件和“损坏”文件时,有什么区别?

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

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