{"id":36,"date":"2008-06-09T13:32:21","date_gmt":"2008-06-09T04:32:21","guid":{"rendered":"http:\/\/www.hi-farm.net\/wp\/?p=36"},"modified":"2008-06-09T13:32:21","modified_gmt":"2008-06-09T04:32:21","slug":"bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82","status":"publish","type":"post","link":"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/","title":{"rendered":"ByteArray\u3067\u6587\u5b57\u3092\u53d6\u5f97\u3057\u3066\u307f\u3088\u3046\u3002"},"content":{"rendered":"<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"ByteArray\u3067\u6587\u5b57\u3092\u53d6\u5f97\u3057\u3066\u307f\u3088\u3046\u3002\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" data-text=\"ByteArray\u3067\u6587\u5b57\u3092\u53d6\u5f97\u3057\u3066\u307f\u3088\u3046\u3002\" data-via=\"mmlemon\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" colorscheme=\"light\" ><\/fb:send><\/div>\n            <div class=\"wsbl_tumblr\"><a href=\"\/\/www.tumblr.com\/share?v=3&u=http%3A%2F%2Fblog.hi-farm.net%2Fen%2F2008%2F06%2F09%2Fbytearray%25e3%2581%25a7%25e6%2596%2587%25e5%25ad%2597%25e3%2582%2592%25e5%258f%2596%25e5%25be%2597%25e3%2581%2597%25e3%2581%25a6%25e3%2581%25bf%25e3%2582%2588%25e3%2581%2586%25e3%2580%2582%2F&t=ByteArray%E3%81%A7%E6%96%87%E5%AD%97%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86%E3%80%82\" title=\"Share on Tumblr\" style=\"display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('\/\/platform.tumblr.com\/v1\/share_1.png') top left no-repeat transparent;\">Share on Tumblr<\/a><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"inline\" href=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" width=\"250\"><\/g:plusone><\/div>\n            <div class=\"wsbl_evernote\">[`evernote` not found]<\/div>\n            <div class=\"wsbl_line\"><a href='http:\/\/line.me\/R\/msg\/text\/?ByteArray%E3%81%A7%E6%96%87%E5%AD%97%E3%82%92%E5%8F%96%E5%BE%97%E3%81%97%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86%E3%80%82%0D%0Ahttp%3A%2F%2Fblog.hi-farm.net%2Fen%2F2008%2F06%2F09%2Fbytearray%25e3%2581%25a7%25e6%2596%2587%25e5%25ad%2597%25e3%2582%2592%25e5%258f%2596%25e5%25be%2597%25e3%2581%2597%25e3%2581%25a6%25e3%2581%25bf%25e3%2582%2588%25e3%2581%2586%25e3%2580%2582%2F' title='LINE\u3067\u9001\u308b' rel=nofollow class='wp_social_bookmarking_light_a' ><img src='http:\/\/blog.hi-farm.net\/wp-content\/plugins\/wp-social-bookmarking-light\/public\/images\/line88x20.png' alt='LINE\u3067\u9001\u308b' title='LINE\u3067\u9001\u308b' width='88' height='20' class='wp_social_bookmarking_light_img' \/><\/a><\/div>\n            <div class=\"wsbl_pocket\"><a href=\"https:\/\/getpocket.com\/save\" class=\"pocket-btn\" data-lang=\"en\" data-save-url=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\" data-pocket-count=\"none\" data-pocket-align=\"left\" >Pocket<\/a><script type=\"text\/javascript\">!function(d,i){if(!d.getElementById(i)){var j=d.createElement(\"script\");j.id=i;j.src=\"https:\/\/widgets.getpocket.com\/v1\/j\/btn.js?v=1\";var w=d.getElementById(i);d.body.appendChild(j);}}(document,\"pocket-btn-js\");<\/script><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n<div style=\"float: right; margin-left: 10px;\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-count=\"vertical\" data-url=\"http:\/\/blog.hi-farm.net\/en\/2008\/06\/09\/bytearray%e3%81%a7%e6%96%87%e5%ad%97%e3%82%92%e5%8f%96%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%88%e3%81%86%e3%80%82\/\">Tweet<\/a><\/div>\n<p>\u4eca\u307e\u3067\u3042\u3093\u307e\u308a\u30bd\u30fc\u30b9\u66f8\u3044\u3066\u3069\u3046\u3053\u3046\u3001\u3068\u3044\u3046\u306e\u3092\u3084\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4eca\u65e5\u306f\u3084\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u5185\u5bb9\u306f\u57fa\u672c\u7684\u306a\u3053\u3068\u3060\u3068\u601d\u3046\u306e\u3067\u3001<br \/>\n\u300c\u4f55\u3092\u3044\u307e\u3055\u3089\u3053\u3093\u306a\u3053\u3068\u66f8\u304d\u3084\u304c\u3063\u3066\u300d\u3068\u3044\u3046\u3053\u3068\u3092\u601d\u3046\u65b9\u3082\u3044\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u305d\u3053\u306f\u8a31\u3057\u3066\u4e0b\u3055\u3044\u3002\u8a31\u3057\u3066\u4e0b\u3055\u3044\u3002<\/p>\n<p>\u30c6\u30fc\u30de\u306f\u3001\u300eByteArray\u3092\u4f7f\u3063\u3066\u30d0\u30a4\u30ca\u30ea\u3067\u6587\u5b57\u3092\u5224\u5b9a\u3057\u3088\u3046\u300f\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u8aad\u307f\u8fbc\u3082\u3046\u3068\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u304cflv\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u5b9a\u3059\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u4ed5\u69d8\u3067\u3042\u308b\u304b\u3092\u3057\u3063\u304b\u308a\u78ba\u8a8d\u3057\u305f\u8a33\u3067\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u30d0\u30a4\u30ca\u30ea\u30a8\u30c7\u30a3\u30bf\u3067flv\u3092\u958b\u3044\u3066\u307f\u308b\u3068\u3001\u753b\u50cf<br \/>\n<a rel=\"lightbox\" href=\"http:\/\/blog.hi-farm.net\/images\/flv.jpg\" target=\"_blank\">http:\/\/blog.hi-farm.net\/images\/flv.jpg<\/a><br \/>\n\u306e\u69d8\u306b\u3001<br \/>\n\u982d\u306b\u300eFLV\u300f\u3068\u66f8\u3044\u3066\u3044\u308b\u306e\u3092\u767a\u898b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u306b\u300eFLV\u300f\u3068\u66f8\u3044\u3066\u3044\u308c\u3070.flv\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308b\u3001\u3068\u3044\u3046\u5224\u5b9a\u65b9\u6cd5\u3067\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001\u5225\u306bflex\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3082\u5225\u306b\u826f\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306fAIR\u3067\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u4ee5\u4e0b\u3001\u30bd\u30fc\u30b9\u3067\u3059\u3002<\/p>\n<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;<br \/>\n&lt;mx:WindowedApplication xmlns:mx=&#8221;<a href=\"http:\/\/www.adobe.com\/2006\/mxml%22\" target=\"_blank\">http:\/\/www.adobe.com\/2006\/mxml&#8221;<\/a>; layout=&#8221;absolute&#8221; creationComplete=&#8221;initApp()&#8221;&gt;<br \/>\n&lt;mx:Script&gt;<br \/>\n&lt;![CDATA[<\/p>\n<p>import flash.filesystem.File;<br \/>\nimport flash.filesystem.FileMode;<br \/>\nimport flash.filesystem.FileStream;<\/p>\n<p>import flash.utils.ByteArray;<\/p>\n<p>private var f:File;<br \/>\nprivate var fs:FileStream;<br \/>\nprivate var byteAry:ByteArray;<\/p>\n<p>private function initApp():void{<br \/>\nvar path:String = &#8220;\/example.flv&#8221;;\t\/\/\u53d6\u5f97\u3057\u305f\u3044\u30d1\u30b9<br \/>\nretreiveFileData(path);<br \/>\n}<\/p>\n<p>private function retreiveFileData(path:String):void{<\/p>\n<p>try{\t\/\/try\u3057\u3066\u304a\u304b\u306a\u3044\u3068\u3001\u30a8\u30e9\u30fc\u304c\u8d77\u304d\u305f\u3068\u304d\u306b\u6b62\u307e\u3063\u3066\u3057\u307e\u3046<br \/>\nf = new File(path);<br \/>\nfs = new FileStream();<br \/>\nbyteAry = new ByteArray();<br \/>\nfs.open(f, FileMode.READ);<br \/>\nfs.readBytes(byteAry, 0, fs.bytesAvailable);\t\/\/\u5168\u90e8\u9802\u304f\uff01\uff08\u30d0\u30a4\u30ca\u30ea\u3067\uff09<br \/>\nvar result:Boolean = retreiveFLV_Binary(byteAry);<br \/>\nif(result)\tresult_ta.text = &#8220;This File is valid FLV file.&#8221;;<br \/>\nelse\tresult_ta.text = &#8220;This File is NOT valid FLV file.&#8221;;<br \/>\n}<br \/>\ncatch(e:Error){<br \/>\nresult_ta.text = e.message;\t\/\/\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a<br \/>\n}<br \/>\nfinally{<br \/>\nfs.close();\t\/\/\u4f55\u304c\u8d77\u304d\u3066\u3082\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u9589\u3058\u307e\u3059<br \/>\n}<\/p>\n<p>}<br \/>\nprivate function retreiveFLV_Binary(ba:ByteArray):Boolean{<br \/>\n\/*<br \/>\n\u3061\u306a\u307f\u306b\u3001FLV\u306e\u4ed5\u69d8\u3067\u306f\u3001\u4e00\u756a\u59cb\u3081\u306b\u3001&#8221;FLV&#8221;\u3068\u3044\u3046\u6587\u5b57\u304c\u5165\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n\u306a\u306e\u3067\u3001FLV\u306e\u6587\u5b57\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u8abf\u3079\u307e\u3059\u3002Byte\u3067\u3002<br \/>\n\u3061\u306a\u307f\u306b\u3001F L V \u306e\u30d0\u30a4\u30c8\u8868\u73fe\u306f\u3001<br \/>\n\u6587\u5b57 : \u30d0\u30a4\u30c8\u8868\u73fe<br \/>\nF : 46<br \/>\nL : 4C<br \/>\nV : 56<br \/>\n\u3067\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u306e\u982d\u306b\u3053\u306e\u30c7\u30fc\u30bf\u304c\u3042\u308c\u3070\u3001FLV\u3068\u898b\u306a\u3057\u307e\u3059\u3002<br \/>\n*\/<br \/>\n\/\/\u3053\u306e\u8fba\u306f\u3082\u3063\u3068\u3044\u3044\u66f8\u304d\u65b9\u304c\u3042\u308b\u306f\u305a\u3002<br \/>\nvar FLV_byte:Array = [parseInt(&#8220;0x46&#8221;,16),parseInt(&#8220;0x4C&#8221;,16),parseInt(&#8220;0x56&#8243;,16)];\t\/\/FLV\u306eByte\u8868\u73fe<br \/>\nvar ba_ary:Array = [ba[0],ba[1],ba[2]];\t\/\/\u8abf\u3079\u308b\u5bfe\u8c61\u306eByteArray\u3092Array\u306b\u5206\u3051\u305f\u914d\u5217<\/p>\n<p>\/\/\u5224\u5b9a\u7d50\u679c\u3092\u8fd4\u3059\u5909\u6570\u3002 3\u884c\u4e0b\u306b\u3001\u300e!=\u300f \u3068\u66f8\u3044\u3066\u3044\u308b\u901a\u308a\u3001res\u304cfalse\u306b\u306a\u308b\u5834\u5408\u306e\u5224\u5b9a\u3092<br \/>\n\/\/\u3057\u3066\u3044\u308b\u306e\u3067\u3001res\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u306ftrue\u3002<br \/>\nvar res:Boolean = true;<br \/>\nfor(var i:int = 0; i &lt; 3; i++){<br \/>\nif(FLV_byte[i] != ba_ary[i]){\t\/\/\u30c7\u30fc\u30bf\u304c\u9055\u3063\u3066\u305f\u3089\u305d\u306e\u5834\u3067\u30eb\u30fc\u30d7\u7d42\u4e86<br \/>\nres = false;<br \/>\nbreak;<br \/>\n}<br \/>\n}<br \/>\nreturn res;<br \/>\n}<br \/>\n]]&gt;<br \/>\n&lt;\/mx:Script&gt;<br \/>\n&lt;mx:VBox&gt;<br \/>\n&lt;mx:Label text=&#8221;\u30d0\u30a4\u30ca\u30ea\u306eFLV\u30c7\u30fc\u30bf&#8221; \/&gt;<br \/>\n&lt;mx:TextArea id=&#8221;result_ta&#8221; width=&#8221;300&#8243; height=&#8221;300&#8243; \/&gt;<br \/>\n&lt;\/mx:VBox&gt;<br \/>\n&lt;\/mx:WindowedApplication&gt;<\/p>\n<p>\u3053\u308c\u3092\u30d1\u30d6\u30ea\u30c3\u30b7\u30e5\u3059\u308b\u3068\u3001<br \/>\n18\u884c\u76ee\u306epath\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u304cflv\u306e\u5834\u5408\u306f\u3001<br \/>\n&#8220;This File is valid FLV file.&#8221;<\/p>\n<p>\u9055\u3046\u5834\u5408\u306f\u3001<br \/>\n&#8220;This File is NOT valid FLV file.&#8221;<br \/>\n\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u591a\u5206\u3001\u300c\u3053\u3093\u306a\u66f8\u304d\u65b9\u3088\u308a\u3053\u306e\u65b9\u304c\u901f\u3044\uff01\u304d\u308c\u3044\uff01\u300d\u306a\u3069\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u3082\u3057\u3088\u308d\u3057\u3051\u308c\u3070\u3064\u3063\u3053\u3093\u3067\u3084\u3063\u3066\u3044\u305f\u3060\u3051\u308b\u3068\u5927\u5909\u3046\u308c\u3057\u3044\u3067\u3059\u3002<\/p>\n<p>2007\u5e749\u670815\u65e502:15<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tweet \u4eca\u307e\u3067\u3042\u3093\u307e\u308a\u30bd\u30fc\u30b9\u66f8\u3044\u3066\u3069\u3046\u3053\u3046\u3001\u3068\u3044\u3046\u306e\u3092\u3084\u3063\u3066\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u4eca\u65e5\u306f\u3084\u3063\u3066\u307f\u307e\u3059\u3002 \u5185\u5bb9\u306f\u57fa\u672c\u7684\u306a\u3053\u3068\u3060\u3068\u601d\u3046\u306e\u3067\u3001 \u300c\u4f55\u3092\u3044\u307e\u3055\u3089\u3053\u3093\u306a\u3053\u3068\u66f8\u304d\u3084\u304c\u3063\u3066\u300d\u3068\u3044\u3046\u3053\u3068\u3092\u601d\u3046\u65b9\u3082\u3044\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u305d\u3053\u306f\u8a31 &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[232,46],"_links":{"self":[{"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/posts\/36"}],"collection":[{"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":0,"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.hi-farm.net\/en\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}