开发者

Zip in j2me using jazzlib

I am using jazzlib package in j2me application to compress开发者_如何学Go 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


You send the compressed stream as a String? That's your problem(s) right there:

  • compressed data is binary data (i.e. byte[]).
  • String is designed to handle textual (Unicode) data and not arbitrary binary data
  • converting arbitrary binary data to String is bound to lead to problems

So 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 with byte[]/InputStream/OutputStream.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜