
{"id":5702,"date":"2011-09-03T13:45:26","date_gmt":"2011-09-03T13:45:26","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=5702"},"modified":"2011-09-03T13:45:26","modified_gmt":"2011-09-03T13:45:26","slug":"bzip2-bunzip2-a-block-sorting-file-compressor-v1-0-4","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2011\/09\/03\/bzip2-bunzip2-a-block-sorting-file-compressor-v1-0-4\/","title":{"rendered":"bzip2, bunzip2 &#8211; a block-sorting file compressor, v1.0.4"},"content":{"rendered":"<p><a href=\"http:\/\/www.beautifulwork.org\/2011\/09\/03\/linux-3-0-4-compile-howto\/\">Connected From This<\/a><\/p>\n<h4><u> A UNIX Command <\/u><\/h4>\n<pre>\n$wget http:\/\/www.kernel.org\/pub\/linux\/kernel\/v3.0\/patch-3.0.4.bz2\n--2011-09-03 19:22:43--  http:\/\/www.kernel.org\/pub\/linux\/kernel\/v3.0\/patch-3.0.4.bz2\nResolving www.kernel.org... 130.239.17.5, 149.20.4.69, 199.6.1.165, ...\nConnecting to www.kernel.org|130.239.17.5|:80... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 96120 (94K) [application\/x-bzip2]\nSaving to: `patch-3.0.4.bz2'\n\n100%[===================================================================================&gt;] 96,120      85.3K\/s   in 1.1s\n\n2011-09-03 19:22:45 (85.3 KB\/s) - `patch-3.0.4.bz2' saved [96120\/96120]\n\n$bunzip2 patch-3.0.4.bz2\n$ls patch-3.0.4\npatch-3.0.4\n$\n\n\n<\/pre>\n<h4><u> UNIX Explanation <\/u> <\/h4>\n<pre>\nbzip2  compresses files  using the  Burrows-Wheeler block\nsorting text  compression algorithm, and  Huffman coding.\nCompression  is generally  considerably better  than that\nachieved    by    more    conventional    LZ77\/LZ78-based\ncompressors,  and approaches the  performance of  the PPM\nfamily of statistical compressors.\n\n<\/pre>\n<h4><u> Related Source Code Exposition<\/u><\/h4>\n<p><code><br \/>\nfor (t = 0; t &lt; nGroups; t++) {<br \/>\n         minLen = 32;<br \/>\n         maxLen = 0;<br \/>\n         for (i = 0; i len[t][i] &gt; maxLen) maxLen = s-&gt;len[t][i];<br \/>\n            if (s-&gt;len[t][i] len[t][i];<br \/>\n         }<br \/>\n         BZ2_hbCreateDecodeTables (<br \/>\n            &amp;(s-&gt;limit[t][0]),<br \/>\n            &amp;(s-&gt;base[t][0]),<br \/>\n            &amp;(s-&gt;perm[t][0]),<br \/>\n            &amp;(s-&gt;len[t][0]),<br \/>\n            minLen, maxLen, alphaSize<br \/>\n         );<br \/>\n         s-&gt;minLens[t] = minLen;<br \/>\n      }<\/p>\n<p><\/code><\/p>\n<h4><u>Source Code Highlight<\/u><\/h4>\n<p>Create the Huffman decoding tables<\/p>\n<h4><u> Featured Image <\/u><\/h4>\n<p><img decoding=\"async\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/09\/fa27b-bzip2-sep-3-2.png\" \/><\/p>\n<h4><u> Related Knowledge <\/u><\/h4>\n<pre>\nbzip2  expects a  list  of file  names  to accompany  the\ncommand-line   flags.   Each  file   is  replaced   by  a\ncompressed   version    of   itself,   with    the   name\n\"original_name.bz2\".  Each  compressed file has  the same\nmodification  date,   permissions,  and,  when  possible,\nownership  as the corresponding  original, so  that these\nproperties  can be  correctly  restored at  decompression\ntime.   File name  handling is  naive in  the  sense that\nthere is no mechanism for preserving original file names,\npermissions,  ownerships or  dates  in filesystems  which\nlack  these concepts,  or have  serious file  name length\nrestrictions, such as MS-DOS.\n\nsource : debian manual pages for bzip2\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Connected From This A UNIX Command $wget http:\/\/www.kernel.org\/pub\/linux\/kernel\/v3.0\/patch-3.0.4.bz2 &#8211;2011-09-03 19:22:43&#8211; http:\/\/www.kernel.org\/pub\/linux\/kernel\/v3.0\/patch-3.0.4.bz2 Resolving www.kernel.org&#8230; 130.239.17.5, 149.20.4.69, 199.6.1.165, &#8230; Connecting to www.kernel.org|130.239.17.5|:80&#8230; connected. HTTP request sent, awaiting response&#8230; 200 OK Length: 96120 (94K) [application\/x-bzip2] Saving to: `patch-3.0.4.bz2&#8242; 100%[===================================================================================&gt;] 96,120 85.3K\/s in 1.1s 2011-09-03 19:22:45 (85.3 KB\/s) &#8211; `patch-3.0.4.bz2&#8242; saved [96120\/96120] $bunzip2 patch-3.0.4.bz2 $ls patch-3.0.4 patch-3.0.4 $ UNIX &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2011\/09\/03\/bzip2-bunzip2-a-block-sorting-file-compressor-v1-0-4\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;bzip2, bunzip2 &#8211; a block-sorting file compressor, v1.0.4&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5702"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=5702"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5702\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=5702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=5702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=5702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}