This example reads a swf file into a byte array and decompresses / inflates all of the bytes of the swf except for the the first 8 bytes which are always uncompressed. As most swf files have zlib compression applied, file decompression is necessary if you wish to fully parse the swf. As with the previous post on swf compression, this is a very raw example–no file signature or compression checking is performed before attempting to inflate the file.
-
RSS Feeds
-
Categories
-
Archives
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- October 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- December 2006
- November 2006
- October 2006
- August 2006
- May 2006
- April 2006
- March 2006
- December 2005
- October 2005
- September 2005
- August 2005
- July 2005
- June 2005
7 Comments
look dude, this makes no sense at all.
Heh, heh–you should read the file format specification….you know you’re in trouble when it starts to make sense to you.
What type of compression is used for an SWF file? Gzip? zip? bzip? tar?
Hey Mark,
The swf file format uses zlib compression.
hey there, first comment after 2 year!!!
thank you for the code
I’m using it in my own project and I’ve found a bug related to inflater: sometimes finished() is read as false when in fact should be true… workaround is use also count!=0 in while loop.
cheers
hi, it’s me again ;) , the project I was talking about in the last post had become a quite structured one… it is called JavaSWF9 , if you or someone in the audience interested in contributing drop a message at http://www.stefanocottafavi.com
cheers
This can be done with a Perl one-liner instead of 115 lines of Java ;-),
perl -MCompress::Zlib -0777 -e \
‘print uncompress substr , 8;’ flash.swf > flash
One Trackback
Yep…
Yes, I’ve heard of “decaf.” What’s your point?
…