使用 jazzlib 压缩 j2me
我在 j2me 应用程序中使用 jazzlib 包,使用 ZipOutputStream 压缩 zip 格式的 xml 文件,并将压缩流作为字符串发送到服务器。我可以使用 ZipInputStream 在移动设备中解压缩。但在服务器中我无法解压,我得到了 EOF 异常。当我从控制台复制压缩流并放入浏览器时,空白区域在压缩流中放置了特殊字符,例如 [] 。我不明白发生了什么事。请帮忙
I am using jazzlib package in j2me application to compress the xml file in zip format using ZipOutputStream and the send the compress stream to the server as a string . I am able to do unzip the in mobile using ZipInputStream. But in server i am not able to unzip , i got
EOF exception. when i copy the compressed stream from console and put into browser, the empty space put special character like [] in compressed stream. I didnt understand what happened. Plz help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将压缩流作为字符串发送?这就是您的问题:
byte[]
)。String
旨在处理文本(Unicode)数据,而不是任意二进制数据,String
必然会导致问题所以如果如果您想要处理(发送/接收/...)二进制数据,请确保您永远不会使用
String
/Reader
/Writer
来处理过程中任何地方的数据。继续使用byte[]
/InputStream
/OutputStream
。You send the compressed stream as a String? That's your problem(s) right there:
byte[]
).String
is designed to handle textual (Unicode) data and not arbitrary binary dataString
is bound to lead to problemsSo if you want to handle (send/receive/...) binary data, make sure you never use a
String
/Reader
/Writer
to handle the data anywhere in the process. Stay withbyte[]
/InputStream
/OutputStream
.