{"id":1443,"date":"2008-10-24T23:27:00","date_gmt":"2008-10-24T14:27:00","guid":{"rendered":"https:\/\/hdmr.org\/d\/?e=164"},"modified":"2008-10-24T23:27:00","modified_gmt":"2008-10-24T14:27:00","slug":"blogn-164","status":"publish","type":"post","link":"https:\/\/hdmr.org\/d\/?e=164","title":{"rendered":"\u96e3\u89e3\u3060\u304cgzip\u306e\u5727\u7e2e\u5c55\u958b\u3067\u3042\u308b"},"content":{"rendered":"<p>\u5fae\u5206\u65b9\u7a0b\u5f0f\u96e3\u3057\u3044\u306d\u3047\u2026\u305d\u308a\u3083\u305d\u3046\u3067\u3059\u304b\u3002<br \/>\u672a\u77e5\u95a2\u6570\u306e\u5fae\u5206\u7a4d\u5206\u3092\u542b\u3080\u65b9\u7a0b\u5f0f\u3068\u3044\u3046\u3053\u3068\u3067\u3001<br \/>\u57fa\u672c\u7684\u306b\u306f\u95a2\u6570\u5f53\u3066\u30b2\u30fc\u30e0\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u305d\u308a\u3083\u96e3\u3057\u3044\u3002<br \/>\u5f0f\u3092\u5909\u5f62\u3057\u3066\u7a4d\u5206\u3057\u3066\u89e3\u304f\u3093\u3067\u3059\u3051\u3069\u306d\u3002<br \/>\u4e00\u968e\u7dda\u5f62\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u306e\u516c\u5f0f\u306a\u3093\u3066\u306e\u304c\u3042\u3063\u3066\u3001\u307e\u3041\u899a\u3048\u308c\u3070\u3044\u3044\u3068\u601d\u3046\u306e\u3060\u304c\u3001<br \/>\u3068\u3093\u3067\u3082\u306a\u3044\u5f0f\u3060\u3057\u3001\u3046\u307e\u304f\u7a4d\u5206\u3067\u304d\u306a\u3044\u306a\u3089\u305d\u306e\u65b9\u7a0b\u5f0f\u306f\u89e3\u3051\u3093\u305e\u3068\u3002<br \/>\u3057\u304b\u3057\u3001\u81ea\u7136\u754c\u306e\u3044\u308d\u3044\u308d\u3092\u8868\u3059\u5f0f\u3063\u3066\u5fae\u5206\u65b9\u7a0b\u5f0f\u3082\u591a\u3044\u305d\u3046\u3060\u3002<br \/>\u4f8b\u3048\u3070\u3060\u3051\u3069\u3001RLC\u76f4\u5217\u56de\u8def\u306b\u76f4\u6d41\u96fb\u5727\u3092\u304b\u3051\u305f\u3089\u3001\u6b63\u5f26\u6ce2\u4ea4\u6d41\u96fb\u6d41\u304c\u6d41\u308c\u308b\u3053\u3068\u3068\u304b\u3002<br \/>L(di\/dt)+Ri+(1\/C)\u222bidt=E\u3001\u3068\u3044\u3046\u65b9\u7a0b\u5f0f\u3092\u89e3\u3051\u3070\u308f\u304b\u308b\u3093\u3060\u3088\u306d\u3002<br \/>\u307e\u3041\u3044\u308d\u3044\u308d\u3042\u308b\u3093\u3067\u3059\u3088\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<hr \/>\n<p>\u6700\u8fd13\u3064\u306e\u30bd\u30d5\u30c8\u30a6\u30a8\u30a2\u3092\u540c\u6642\u306b\u8a2d\u8a08\u30fb\u958b\u767a\u3057\u3066\u308b\u3002<br \/>1\u3064\u306f\u307b\u3068\u3093\u3069\u5b8c\u6210\u3057\u3066\u308b\u306e\u3060\u304c\u3001\u6b8b\u308a2\u3064\u304c\u5927\u5909\u3002<br \/>\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u3092\u4f5c\u3063\u3066\u3001\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u3066\u2026\u3068\u3044\u3046\u3053\u3068\u3092\u7e70\u308a\u8fd4\u3057\u3066\u308b\u3002<br \/>\u307e\u3041\u5c0f\u898f\u6a21\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3060\u304b\u3089\u3067\u304d\u308b\u3053\u3068\u3067\u3059\u3088\u306d\u3002<br \/>\u305d\u308c\u3067\u3001Rich Text Format\u3092\u53d6\u308a\u6271\u304a\u3046\u304b\u306a\u3068\u304b\u601d\u3063\u3066\u8abf\u3079\u3066\u305f\u3002<br \/>RTF\u306a\u3093\u3060\u304c\u3001\u3053\u308c\u304c\u975e\u5e38\u306b\u5197\u9577\u3002\u5727\u7e2e\u3059\u308b\u3068\u3059\u3054\u3044\u5bb9\u91cf\u304c\u6e1b\u308b\u3002<br \/>\u3068\u3044\u3046\u308f\u3051\u3067\u5727\u7e2e\u3057\u305f\u3082\u306e\u3092Base64\u306b\u5909\u63db\u3057\u3066\u304a\u3053\u3046\u3068\u3002<br \/>IronPython\u3067\u958b\u767a\u3057\u3066\u308b\u304c\u3001try\uff5efinally\u3060\u3089\u3051\u3067\u8aad\u307f\u306b\u304f\u3044\u306e\u3067\u3001C#\u3067\u66f8\u3053\u3046\u3002<br \/>\u3069\u3046\u3082Python 2.5\u304b\u3089with\u69cb\u6587\u3068\u3044\u3046\u306e\u304c\u3042\u308b\u305d\u3046\u3060\u304c\u3001\u6b8b\u5ff5\u306a\u304c\u3089IronPython\u3067\u306f\u5b9f\u88c5\u3055\u308c\u3066\u306a\u3044\u3002<br \/>\u307e\u305a\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001\u5727\u7e2e\u3057\u305f\u3082\u306e\u3092Base64\u306b\u5909\u63db\u3057\u3066\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3059\u308b\u4ef6\u3002<\/p>\n<pre>using( System.IO.FileStream fst=new System.IO.FileStream(fname,System.IO.FileMode.Open) ){<br \/>  byte[] buf=new byte[fst.Length];<br \/>  fst.Read(buf,0,buf.Length);<br \/>  using(System.IO.MemoryStream mst=new System.IO.MemoryStream()){<br \/>    using(System.IO.Compression.GZipStream gzst=<br \/>      new System.IO.Compression.GZipStream(mst,System.IO.Compression.CompressionMode.Compress)){<br \/>      gzst.Write(buf,0,buf.Length);<br \/>    }<br \/>    byte[] gzbuf=mst.ToArray();<br \/>    Console.WriteLine( System.Convert.ToBase64String(gzbuf) );<br \/>  }<br \/>}<\/pre>\n<p>using\u69cb\u6587\u3067C#\u3067\u3059\u3089\u76ee\u304c\u75db\u3044\u304c\u3001IronPython\u3067\u306f\u5168\u90e8try\uff5efinally\u3067\u66f8\u3044\u3066\u308b\u306e\u3067\u3055\u3089\u306b\u76ee\u304c\u75db\u3044\u3002<br \/>System.IO.Compression.GZipStream\u306b\u304a\u3044\u3066\u306f\u3001<br \/>\u66f8\u304d\u8fbc\u307e\u308c\u305f\u3089\u5727\u7e2e\u51e6\u7406\u3057\u3066\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u6307\u5b9a\u3055\u308c\u305f\u30b9\u30c8\u30ea\u30fc\u30e0\u306b\u66f8\u304d\u51fa\u3059\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u63d0\u4f9b\u3001<br \/>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u6307\u5b9a\u3055\u308c\u305f\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089\u5c55\u958b\u51e6\u7406\u3057\u305f\u3082\u306e\u3092\u3001\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u63d0\u4f9b\u3001<br \/>\u306e\u3069\u3063\u3061\u304b\u3092\u3067\u304d\u308b\u3002<br \/>\u3057\u304b\u3057\u4f7f\u3044\u306b\u304f\u3044\u4ed5\u69d8\u306a\u3093\u3067\u3059\u3088\u3002<br \/>\u5727\u7e2e\u6642\u3001\u3042\u3089\u304b\u3058\u3081\u3001System.IO.MemoryStream\u3067\u5727\u7e2e\u7d50\u679c\u3092\u53d7\u3051\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u4f5c\u3063\u3066\u304a\u304f\u3001<br \/>\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3067\u3001\u3053\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3068\u3001System.IO.Compression.CompressionMode.Compress\u3067\u5727\u7e2e\u30e2\u30fc\u30c9\u3060\u3068\u3059\u308b\u3002<br \/>\u305d\u308c\u3067\u3001GZipStream\u306e\u306b\u3001Write\u3067\u66f8\u304d\u8fbc\u3080\u3002<br \/>\u305d\u3057\u3066\u3001GZipStream\u3092\u9589\u3058\u305f\u3089\u3001\u5727\u7e2e\u51e6\u7406\u5b8c\u4e86\u3002\u53d7\u3051\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u306b\u306f\u5b8c\u5168\u306a\u7d50\u679c\u304c\u5165\u3063\u3066\u308b\u3002<\/p>\n<hr \/>\n<p>\u5c55\u958b\u51e6\u7406\u3060\u304c\u3001\u3053\u308c\u306f\u660e\u3089\u304b\u306b\u3081\u3093\u3069\u304f\u3055\u3044\u3002<br \/>Base64\u3092\u30d0\u30a4\u30c8\u5217\u306b\u5909\u63db\u3057\u3066\u3001MemoryStream\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u306b\u66f8\u304d\u8fbc\u3093\u3067\u304a\u304f\u3002<br \/>GZipStream\u306e\u3053\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u5c55\u958b\u3059\u308b\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u4f5c\u308b\u3002<br \/>\u3053\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u76f4\u63a5\u4f7f\u3048\u308c\u3070\u3044\u3044\u306e\u3060\u304c\u3001Seek\u4e0d\u53ef\u306a\u306e\u3067\u56f0\u308b\u3053\u3068\u304c\u3042\u308b\u3002<br \/>System.Windows.Forms.RichTextBox\u306eLoadFile\u30e1\u30bd\u30c3\u30c9\u3067RTF\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u3092\u6e21\u3057\u305f\u304b\u3063\u305f\u306e\u3060\u304c\u3001<br \/>Seek\u3067\u304d\u3093\u307f\u305f\u3044\u306a\u4f8b\u5916\u3092\u6295\u3052\u308b\u306e\u3067\u3001\u7121\u7406\u306a\u3093\u3060\u306a\u3068\u3002<br \/>\u305d\u3046\u306a\u308b\u3068MemoryStream\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u306bGZipStream\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u304b\u3089Read\u3057\u305f\u306e\u3092Write\u3059\u308b\u3068\u2026<br \/>\u3053\u3093\u306a\u4f5c\u696d\u3092\u3057\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002\u3053\u308c\u304c\u304b\u306a\u308a\u3081\u3093\u3069\u304f\u3055\u3044\u3002<br \/>\u4ee5\u4e0a\u306e\u51e6\u7406\u3092\u3059\u308b\u3082\u306e\u3002<\/p>\n<pre>byte[] gzbuf=System.Convert.FromBase64String(gzb64)<br \/>using(System.IO.MemoryStream rtfst=new System.IO.MemoryStream()){<br \/>  using(System.IO.MemoryStream gzmst=new System.IO.MemoryStream()){<br \/>    gzmst.Write(gzbuf,0,gzbuf.Length);<br \/>    gzmst.Position=0;<br \/>    using(System.IO.Compression.GZipStream gzst=<br \/>      new System.IO.Compression.GZipStream(gzmst,System.IO.Compression.CompressionMode.Decompress)){<br \/>      byte[] buf=new byte[1024];<br \/>      while(true){<br \/>        int readlen=gzst.Read(buf,0,buf.Length);<br \/>        if(readlen==0)  break;<br \/>        rtfst.Write(buf,0,buf.Length);<br \/>      }<br \/>    }<br \/>  }<br \/>  rtfst.Position=0;<br \/>  rtfboxLoadFile(rtfst,System.Windows.Forms.RichTextBoxStreamType.RichText);<br \/>}<\/pre>\n<p>\u3053\u308c\u306f\u3072\u3069\u3044\u3002\u4e0a\u3067\u8aac\u660e\u3057\u305f\u3068\u304a\u308a\u306e\u3053\u3068\u304c\u66f8\u3044\u3066\u3042\u308a\u307e\u3059\u3002<br \/>gzmst.Position=0; rtfst.Position=0;<br \/>\u306f\u3044\u305a\u308c\u3082MemoryStream\u306bWrite\u3057\u305f\u5f8c\u3001\u6539\u3081\u3066\u30b9\u30bf\u30fc\u30c8\u5730\u70b9\u306b\u623b\u3063\u3066\u3001<br \/>\u3053\u3053\u304b\u3089Read\u3057\u3066\u3044\u305f\u3060\u304f\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<br \/>ToArray\u3067\u914d\u5217\u306b\u5909\u63db\u3059\u308b\u5206\u306b\u306f\u3042\u307e\u308a\u6c17\u306b\u3057\u306a\u3044\u3051\u3069\u3001Read\u3067\u8aad\u3080\u3068\u304d\u306f\u91cd\u8981\u3002<br \/>\u3042\u3068\u3001GZipStream\u3092\u8aad\u307f\u53d6\u308b\u306e\u306b\u30011024Bytes\u306e\u30d0\u30c3\u30d5\u30a1\u3092\u7528\u610f\u3057\u3066\u3001<br \/>\u30eb\u30fc\u30d7\u56de\u3057\u3066\u3001\u8aad\u307f\u53d6\u308a\u6210\u529f\u5206\u3060\u3051MemoryStream\u306b\u66f8\u3044\u3066\u3044\u304f\u3002<br \/>Read\u306e\u8fd4\u308a\u5024\u306f\u8aad\u307f\u53d6\u308a\u6210\u529f\u306e\u30d0\u30a4\u30c8\u6570\u3060\u304c\u3001\u8aad\u3081\u306a\u304f\u306a\u308c\u30700\u306b\u306a\u308b\u306e\u3067\u3053\u308c\u3067\u629c\u3051\u3066\u308b\u3002<br \/>\u3055\u3063\u304d\u306eFileStream\u3067\u306f\u3001Length\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u3042\u3063\u305f\u3051\u3069\u3001GZipStream\u3067\u306f\u4f7f\u3048\u306a\u3044\u3002<br \/>\u3060\u304b\u3089\u3053\u3046\u3044\u3046\u3001\u307e\u3041\u6b63\u653b\u6cd5\u3067\u3084\u3089\u3093\u3068\u3044\u304b\u3093\u3068\u3002<\/p>\n<hr \/>\n<p>\u3053\u308c\u306e\u4f7f\u3044\u9053\u3060\u304c\u3001TCP\u3068\u304b\u3067\u901a\u4fe1\u3059\u308b\u3068\u304d\u30c7\u30fc\u30bf\u3092\u5727\u7e2e\u3059\u308b\u3068\u3002<br \/>\u305d\u306e\u3068\u304d\u3001\u30c7\u30fc\u30bf\u3092GZipStream\u306e\u306bWrite\u3057\u3066\u3001\u53d7\u3051\u308bMemoryStream\u306e\u4e2d\u8eab\u3092\u9001\u4fe1\u3059\u308b\u3068\u3002<br \/>\u53d7\u4fe1\u3057\u3066MemoryStream\u306b\u6295\u3052\u8fbc\u3093\u3060\u3089\u3001\u3053\u308c\u3092GZipStream\u3067\u53d7\u3051\u3066Read\u3057\u3066MemoryStream\u306bWrite\u3001<br \/>\u6700\u5f8c\u306bMemoryStream\u306e\u4e2d\u8eab\u3092\u78ba\u8a8d\u3059\u308c\u3070\u672c\u5f53\u306b\u9001\u308a\u305f\u304b\u3063\u305f\u30c7\u30fc\u30bf\u304c\u3042\u308b\u3068\u3002<br \/>\u307e\u3041\u3053\u3046\u3044\u3046\u4f7f\u3044\u9053\u304c\u591a\u305d\u3046\u3067\u3059\u3002<br \/>\u3061\u306a\u307f\u306b\u3002System.IO.Compression.DeflateStream\u3068\u3044\u3046\u985e\u4f3c\u3057\u305f\u30af\u30e9\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>Deflate\u306fgzip\u3084ZIP\u306e\u539f\u7406\u3067\u3059\u3002Deflate\u3092\u4f7f\u3063\u3066gzip\u3092\u5b9f\u73fe\u3057\u3066\u308b\u306e\u306d\u3002<br \/>\u4eca\u56de\u306e\u306f\u5225\u306bgzip\u3067\u306a\u304f\u3066\u3082Deflate\u3067\u3082\u3088\u304b\u3063\u305f\u6c17\u306f\u3059\u308b\u304c\u3001gzip\u306e\u65b9\u304c\u30c7\u30d0\u30c3\u30b0\u306b\u4fbf\u5229\u3060\u3057\u3044\u3044\u3084\u3002<br \/>\u3053\u3093\u306a\u624b\u9593\u3092\u304b\u3051\u3066\u3084\u308b\u304b\u306f\u77e5\u3089\u3093\u304c\u3001\u6709\u7528\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306a\u306e\u3067\u4f7f\u3046\u3068\u3044\u3044\u3068\u601d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fae\u5206\u65b9\u7a0b\u5f0f\u96e3\u3057\u3044\u306d\u3047\u2026\u305d\u308a\u3083\u305d\u3046\u3067\u3059\u304b\u3002\u672a\u77e5\u95a2\u6570\u306e\u5fae\u5206\u7a4d\u5206\u3092\u542b\u3080\u65b9\u7a0b\u5f0f\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u57fa\u672c\u7684\u306b\u306f\u95a2\u6570\u5f53\u3066\u30b2\u30fc\u30e0\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u305d\u308a\u3083\u96e3\u3057\u3044\u3002\u5f0f\u3092\u5909\u5f62\u3057\u3066\u7a4d\u5206\u3057\u3066\u89e3\u304f\u3093\u3067\u3059\u3051\u3069\u306d\u3002\u4e00\u968e\u7dda\u5f62\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u306e\u516c\u5f0f\u306a\u3093\u3066\u306e\u304c\u3042\u3063\u3066\u3001 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1443","post","type-post","status-publish","format-standard","hentry","category-computer"],"_links":{"self":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1443"}],"version-history":[{"count":0,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=\/wp\/v2\/posts\/1443\/revisions"}],"wp:attachment":[{"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hdmr.org\/d\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}