Re: [flexcoders] Re: Reading compressed file in AS 3

2009-02-27 Thread David Adams
On Fri, Feb 27, 2009 at 12:42 PM, ACasualObserver  wrote:
> Jim,
>
> I am using the zlib in a C program.

Just as an experiment, have you tried putting the code into an AIR
application where you can specify a wider range of decompression
methods? I'm struggling with the same error you've described using a
zlib compressor. I've found that I _can_ decompress the ByteArray in
an AIR app with code like the following, where ba contains my zipped
data:

ba.uncompress(CompressionAlgorithm.DEFLATE)

I actually find this a bit confusing as my understanding is that Flex
handles deflate...so I'm unclear what I'm doing/not doing in Flex that
makes the compression fail. I've really got the same code - apart from
the CompressionAlgorithm argument. Anyway, it's something else for you
to try...not that I know what the results mean ;-) Perhaps someone
else can offer a suggestion as to what this particular finding means.
(I'm new to Flex.)

For background, what I'm trying to experiment with is compressing XML
on the server-side and decompressing it on the client-side to see if I
can improve performance. If anyone has thoughts or suggestions on this
topic, I'm all ears. (AMF is not supported on the server I'm using, so
AMF-over-HTTP is not an option.)



-
 David Adams
 dpad...@gmail.com
 AU: (02) 6493-3250
 US: 831 621-4585
 Wallaga Lake 2546 NSW
-


Re: [flexcoders] Re: Reading compressed file in AS 3

2009-02-26 Thread Jim Cheng
I'm assuming you're using PHP based upon gzopen.

 From reading the zlib library documentation, you'll want to use the 
gzcompress function instead of gzopen to compress your string into the 
zlib data format (which corresponds to ByteArray's compress/uncompress 
methods).  Note that gzopen uses a slightly different data format, gzip, 
which is based upon, but incompatible with zlib.  This likely accounts 
for the slight difference in file size and your inability to decompress 
the file on the Flex side of things.

Hope this helps,

Jim

ACasualObserver wrote:
> 
> I create the compressed file by calling gzopen. I use wb9 for the
> mode. Should I used another mode?
> 


RE: [flexcoders] Re: Reading compressed file in AS 3

2009-02-26 Thread Alex Harui
Note that ByteArray cannot consume a .ZIP file, as it contains a catalog.  It 
only handles the actual compressed bytes.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of ACasualObserver
Sent: Thursday, February 26, 2009 2:48 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Reading compressed file in AS 3


Thanks for the quick response. Both my server and client are Windows.
Actually they are the same machine!!!

I will try the checksum tomorrow but I checked number of bytes that
are both the same.

Another test I did was to send the uncompressed file and read into a
ByteArray. When I compress the ByteArray on the sever, the result is
13 bytes larger than the compressed file. Compressed files is over
88,000 bytes.

I create the compressed file by calling gzopen. I use wb9 for the
mode. Should I used another mode?

Thanks.

--- In flexcoders@yahoogroups.com, Maciek 
Sakrejda  wrote:
>
> What are the other bytes ;) ?
>
> I've run into some issues working with low-level bit-twiddling before
> (only on Linux, but that still may be indicative of larger problems).
> For example, in FP9 on Linux, sending a payload with a POST URLRequest
> truncates the payload data at the first 0x00 byte (!). On FP10 in Linux,
> that seems to have been fixed, but I'm getting a different error that I
> have not yet tracked down.
>
> I'm not sure if your issue is related, but I'd make sure your data makes
> it to the client okay before you try to decompress it. E.g., can you
> compute a checksum for both client and server and compare?
> --
> Maciek Sakrejda
> Truviso, Inc.
> http://www.truviso.com
>