Search Options
close
Search the following clips:
All Clips
news
science
politics
food
economy
art
technology
health
internet
religion
psychology
Sign Up
Install
Learn More
Login
AS3でデータ圧縮するならZipのライブラリよりByteArray.compress
schneemoca
follow
0
10-5-2009 3:36 PM
76 views
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Today's Top Clips
The Gorgeous Arctic Fox
Certified Pet Therapy: Dogs visiting the sick and injured at hospitals +PICS
Scientists say Dolphins Should be Treated as 'Non-Human Persons'
10 Most Fascinating Natural Phenomena.
Obama Approval Index Month-by-Month
How to use CopyTaste, by request
"Music is not a luxury,but a necessity."
Gay Republican Guilt Camp
Don't look away..........
Global Warming Nonsense Coming to an End
visit the
Top Clips page
View the Top Clips from
October 5, 2009
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/27b2d91a-1a7a-4eaa-a334-3658bd2cca52/420914EE-83BD-4A79-BDE0-96FA7068AC3A/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://un-q.net/2009/07/as3_zip_bytearray_compress.html" href="http://un-q.net/2009/07/as3_zip_bytearray_compress.html" style="font-size: 11px;">un-q.net</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html"><H2 id="archive-title">AS3でデータ圧縮するならZipのライブラリよりByteArray.compress</H2></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html"><DIV> Flashで大きめのデータを扱うときに、圧縮したいことなんかがあるんだけど、とりあえず思いつくのがZIPのライブラリ。以前ちょっと紹介したりしました。</DIV></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html">ActionScript 3.0 でZIPの圧縮と解凍 (Unknown Quality)<BR /><DIV> <A href="http://un-q.net/2009/06/actionscript_30_zip_as3.html">http://un-q.net/2009/06/actionscript_30_zip_as3.html</A></DIV></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html"><DIV> 上のエントリーにも書いたんだけど、解凍が結構時間かかる。そんなときはByteArrayクラスのcompressメソッドがおすすめ。</DIV></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html"><PRE>var data:ByteArray = new ByteArray(); data.writeUTF("hogehogehoegho....."); data.compress() // 圧縮 data.uncompress() // 解凍 </PRE></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html"><DIV> たとえばcollada形式の3Dモデルデータを読み込むときなんかに使えます。colladaはXML形式のデータなので圧縮すると結構容量が減ります。まずcolladaのXMLをFlashに読み込みByteArrayにしてcompressして、それをファイルとして保存してしまいます。コンテンツではその保存したデータを読み込んでuncompressして使う感じです。</DIV></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html">// URLLoaderでcolladaのデータを読み込む // ここはURLLoaderのEvent.COMPLETEハンドラ内 // _loaderがURLLoader var b:ByteArray = new ByteArray(); b.writeUTFBytes(_loader.data); // _loader.dataにcolladaのXMLデータ b.compress(); stage.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void { var file:FileReference = new FileReference(); file.save(b, "filename.dat"); }); </blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://un-q.net/2009/07/as3_zip_bytearray_compress.html">ZIP圧縮と圧縮率が変わらないのは、FlashPlayerでのcompressはzlibのアルゴリズムを使ってるからです。</blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/420914EE-83BD-4A79-BDE0-96FA7068AC3A/blog/" title="blog or email this clip"><img src="http://content8.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
New from the makers of Clipmarks:
Amplify.com - Don't just share the news...Amplify it!
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Copyright
Privacy
EULA
OK