??xml version="1.0" encoding="utf-8" standalone="yes"?>懂色一区二区三区免费观看,国产亚洲视频系列,久久久在线视频http://www.aygfsteel.com/wenhl5656/category/34913.html惌v和老肖研究中断的日子,倍觉温馨zh-cnTue, 22 Dec 2009 00:08:04 GMTTue, 22 Dec 2009 00:08:04 GMT60Q{QTBU别的网容器实现方法参?/title><link>http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280073.html</link><dc:creator>爱吃鱼头</dc:creator><author>爱吃鱼头</author><pubDate>Thu, 04 Jun 2009 13:04:00 GMT</pubDate><guid>http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280073.html</guid><wfw:comment>http://www.aygfsteel.com/wenhl5656/comments/280073.html</wfw:comment><comments>http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280073.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wenhl5656/comments/commentRss/280073.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wenhl5656/services/trackbacks/280073.html</trackback:ping><description><![CDATA[     摘要: 转自javaeye。一个高性能的Web爬虫Q必L一个合适的|页容器。该定w最大的特点是要能够通过URL直接存取|页内容Qƈ且要求有很高的性能Q在一个千万别的容器中存取一万次的时间应?分钟左右(普通PC?。采用拆L(fng)办法Q在文gpȝ的基上徏立一l大文g和一l辅助文Ӟ辅助文g实现通过URL定位该URL代表的网在大文件中的位|,从页实现不随文g数量增长而性能变化的快速存取。以下将描述一个简z的实现?   <a href='http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280073.html'>阅读全文</a><img src ="http://www.aygfsteel.com/wenhl5656/aggbug/280073.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wenhl5656/" target="_blank">爱吃鱼头</a> 2009-06-04 21:04 <a href="http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280073.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>常用中文分词- 整理攉http://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280071.html爱吃鱼头爱吃鱼头Thu, 04 Jun 2009 13:01:00 GMThttp://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280071.htmlhttp://www.aygfsteel.com/wenhl5656/comments/280071.htmlhttp://www.aygfsteel.com/wenhl5656/archive/2009/06/04/280071.html#Feedback0http://www.aygfsteel.com/wenhl5656/comments/commentRss/280071.htmlhttp://www.aygfsteel.com/wenhl5656/services/trackbacks/280071.html阅读全文

爱吃鱼头 2009-06-04 21:01 发表评论
]]>
字符集编码和~码字符集(转摘Q?/title><link>http://www.aygfsteel.com/wenhl5656/archive/2009/02/20/255893.html</link><dc:creator>爱吃鱼头</dc:creator><author>爱吃鱼头</author><pubDate>Fri, 20 Feb 2009 13:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/wenhl5656/archive/2009/02/20/255893.html</guid><wfw:comment>http://www.aygfsteel.com/wenhl5656/comments/255893.html</wfw:comment><comments>http://www.aygfsteel.com/wenhl5656/archive/2009/02/20/255893.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wenhl5656/comments/commentRss/255893.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wenhl5656/services/trackbacks/255893.html</trackback:ping><description><![CDATA[    字符集,指的是被分配?jin)整数编L(fng)<span style="color: #0817ff;">字符集合</span>Q?br />     但是Q编码字W集中字W被分配的整数编P不一定就是该字符在计机中存储时所使用的|<br />     计算Z存储的字W到底用什么二q制整数值来表示Q是?span style="color: #388fff;">字符集编?/span>军_的?br /> <br />     字符集编码决定了(jin)如何一个字W的整数~号对应C个二q制的整数倹{?br />     有的~码Ҏ(gu)单的该整数值直接作为其在计机中的表示而存储,例如英文字符?br />     几乎所有的字符集编码方案中Q英文字母的整数~号与其在计机内部存储的二q制形式都一致?br />     但有的编码方案,例如适用于Unicode字符集的UTF-8~码形式Q就很大一部分字符的整数编号作?jin)变换后存储在计机中?br />     ?#8220;?#8221;字ؓ(f)例,“?#8221;的Unicodegؓ(f)0x6C49Q但其编码ؓ(f)UTF-8格式后的gؓ(f)0xE6B189Q注意到变成?jin)三个字节?j)?br /> <br />     GB2312最初指的是一个编码字W集Q其中包含了(jin)ASCII所包含的英文字W,同时加入?763个简体汉字以?qing)其他一些ASCII之外的符受GB2312也有自己的编码方案,但这个方案直接用一个字W在GB2312中的~号作ؓ(f)存储|与UTF-32的做法类|(j)?br />     我们日常说vGB2312的时候,<strong>常常x(chng)q个字符集,也指q种~码Ҏ(gu)</strong>?br /> <br />     GBK是GB2312的后l标准,d?jin)更多的汉字和特D符PcM的是QGBK也是同时指他的字W集和他的编码?br />     GBKq是现如今中文Windows操作pȝ的系l默认编码(q正是几乎所有网上的,文g里的q问题的根源)(j)?br /> <br />     在Java中,字符只以一U编码Ş式存在,那就是UTF-16?br />     ?#8220;在Java?#8221;到底是指在哪里呢Q就是指在JVM中,在内存(sh)Q代码里声明的每一个charQStringcd的变量中?br /> <br />     Python中既可以按Ascii~码Q也可以按unicode~码?br />   <br /> <img src ="http://www.aygfsteel.com/wenhl5656/aggbug/255893.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wenhl5656/" target="_blank">爱吃鱼头</a> 2009-02-20 21:58 <a href="http://www.aygfsteel.com/wenhl5656/archive/2009/02/20/255893.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Base64~码学习(fn)和java源程序实?/title><link>http://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247948.html</link><dc:creator>爱吃鱼头</dc:creator><author>爱吃鱼头</author><pubDate>Tue, 23 Dec 2008 09:36:00 GMT</pubDate><guid>http://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247948.html</guid><wfw:comment>http://www.aygfsteel.com/wenhl5656/comments/247948.html</wfw:comment><comments>http://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247948.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.aygfsteel.com/wenhl5656/comments/commentRss/247948.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/wenhl5656/services/trackbacks/247948.html</trackback:ping><description><![CDATA[<a title="Google" >Google </a>Base64可以搜到相关原理和许多实现?br /> 下面是我的实玎ͼ和SUN公司提供的参考实现?br /> <div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 128, 128);">  1</span> <span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> Base64 {<br /> </span><span style="color: rgb(0, 128, 128);">  2</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> String base64_alphabet </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);">  3</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);">  4</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 128, 128);">  5</span> <span style="color: rgb(0, 128, 0);">     * ~码原理:?个字节{换成4个字? (3 X 8) = 24 = (4 X 6) )<br /> </span><span style="color: rgb(0, 128, 128);">  6</span> <span style="color: rgb(0, 128, 0);">     * 先读?个字?每读一个字?左移8?再右Ud?每次6?q样有4个字节了(jin)<br /> </span><span style="color: rgb(0, 128, 128);">  7</span> <span style="color: rgb(0, 128, 0);">     * <br /> </span><span style="color: rgb(0, 128, 128);">  8</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> data<br /> </span><span style="color: rgb(0, 128, 128);">  9</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> ~码后的Base64字符?br /> </span><span style="color: rgb(0, 128, 128);"> 10</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 11</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> String Base64Encode(</span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] data) {<br /> </span><span style="color: rgb(0, 128, 128);"> 12</span> <span style="color: rgb(0, 0, 0);">        StringBuilder builder </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> StringBuilder();<br /> </span><span style="color: rgb(0, 128, 128);"> 13</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[] temp </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">];<br /> </span><span style="color: rgb(0, 128, 128);"> 14</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> len </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> data.length </span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 15</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> len; i </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 16</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> goal </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 17</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; j </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">; j</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 18</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);"><<=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 19</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);">|=</span><span style="color: rgb(0, 0, 0);"> (data[i </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> j] </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0xff</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 20</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);"> 21</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> k </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; k </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">; k</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 22</span> <span style="color: rgb(0, 0, 0);">                temp[k] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> goal </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0x3f</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 23</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);">>>=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 24</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);"> 25</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> k </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">; k </span><span style="color: rgb(0, 0, 0);">>=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; k</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 26</span> <span style="color: rgb(0, 0, 0);">                builder.append(base64_alphabet.charAt(temp[k]));<br /> </span><span style="color: rgb(0, 128, 128);"> 27</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);"> 28</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);"> 29</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> index;<br /> </span><span style="color: rgb(0, 128, 128);"> 30</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">switch</span><span style="color: rgb(0, 0, 0);"> (data.length </span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 31</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">:<br /> </span><span style="color: rgb(0, 128, 128);"> 32</span> <span style="color: rgb(0, 0, 0);">            index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 33</span> <span style="color: rgb(0, 0, 0);">            builder.append(base64_alphabet.charAt(index));<br /> </span><span style="color: rgb(0, 128, 128);"> 34</span> <span style="color: rgb(0, 0, 0);">            index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0x03</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 35</span> <span style="color: rgb(0, 0, 0);">            builder.append(base64_alphabet.charAt(index));<br /> </span><span style="color: rgb(0, 128, 128);"> 36</span> <span style="color: rgb(0, 0, 0);">            builder.append(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 37</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 38</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">case</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">:<br /> </span><span style="color: rgb(0, 128, 128);"> 39</span> <span style="color: rgb(0, 0, 0);">            index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 40</span> <span style="color: rgb(0, 0, 0);">            builder.append(base64_alphabet.charAt(index));<br /> </span><span style="color: rgb(0, 128, 128);"> 41</span> <span style="color: rgb(0, 0, 0);">            index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0x03</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 42</span> <span style="color: rgb(0, 0, 0);">                    </span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(0, 0, 0);"> data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 43</span> <span style="color: rgb(0, 0, 0);">            builder.append(base64_alphabet.charAt(index));<br /> </span><span style="color: rgb(0, 128, 128);"> 44</span> <span style="color: rgb(0, 0, 0);">            index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (data[data.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0x0f</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);"><<</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 45</span> <span style="color: rgb(0, 0, 0);">            builder.append(base64_alphabet.charAt(index));<br /> </span><span style="color: rgb(0, 128, 128);"> 46</span> <span style="color: rgb(0, 0, 0);">            builder.append(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 47</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 48</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);"> 49</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> builder.toString();<br /> </span><span style="color: rgb(0, 128, 128);"> 50</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);"> 51</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 52</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 53</span> <span style="color: rgb(0, 128, 0);">     * 解码原理:?个字节{换成3个字? 先读???用或q算),每次左移6?再右U??每次8?<br /> </span><span style="color: rgb(0, 128, 128);"> 54</span> <span style="color: rgb(0, 128, 0);">     * <br /> </span><span style="color: rgb(0, 128, 128);"> 55</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> data<br /> </span><span style="color: rgb(0, 128, 128);"> 56</span> <span style="color: rgb(0, 128, 0);">     *            需解码的Base64字符丌Ӏ?br /> </span><span style="color: rgb(0, 128, 128);"> 57</span> <span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);"> byte[]Q解码出的字节数l?br /> </span><span style="color: rgb(0, 128, 128);"> 58</span> <span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 59</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] Base64Decode(String data) {<br /> </span><span style="color: rgb(0, 128, 128);"> 60</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">char</span><span style="color: rgb(0, 0, 0);">[] chArray </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> data.toCharArray();<br /> </span><span style="color: rgb(0, 128, 128);"> 61</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> len </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> chArray.length;<br /> </span><span style="color: rgb(0, 128, 128);"> 62</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] result </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[len </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">];<br /> </span><span style="color: rgb(0, 128, 128);"> 63</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, res_i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> len; i </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">, res_i </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 64</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> goal </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 65</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 66</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> k </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; k </span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);">; k</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 67</span> <span style="color: rgb(0, 0, 0);">                index </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> base64_alphabet.indexOf(chArray[i </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> k]);<br /> </span><span style="color: rgb(0, 128, 128);"> 68</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);"><<=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 69</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);">|=</span><span style="color: rgb(0, 0, 0);"> index;<br /> </span><span style="color: rgb(0, 128, 128);"> 70</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);"> 71</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> j </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">; j </span><span style="color: rgb(0, 0, 0);">>=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; j</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">) {<br /> </span><span style="color: rgb(0, 128, 128);"> 72</span> <span style="color: rgb(0, 0, 0);">                result[res_i </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> j] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">) goal;<br /> </span><span style="color: rgb(0, 128, 128);"> 73</span> <span style="color: rgb(0, 0, 0);">                goal </span><span style="color: rgb(0, 0, 0);">>>=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">8</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 74</span> <span style="color: rgb(0, 0, 0);">            }<br /> </span><span style="color: rgb(0, 128, 128);"> 75</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);"> 76</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> {号=的处?/span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 77</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (chArray[len </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(0, 128, 128);"> 78</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> result;<br /> </span><span style="color: rgb(0, 128, 128);"> 79</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (chArray[len </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">] </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(0, 128, 128);"> 80</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> Arrays.copyOf(result, result.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 81</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 82</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> Arrays.copyOf(result, result.length </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(0, 128, 128);"> 83</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 84</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);"> 85</span> <span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> ?nbsp;s q行 BASE64 ~码</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 86</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> String getBASE64(String s) {<br /> </span><span style="color: rgb(0, 128, 128);"> 87</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (s </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(0, 128, 128);"> 88</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 89</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> sun.misc.BASE64Encoder()).encode(s.getBytes());<br /> </span><span style="color: rgb(0, 128, 128);"> 90</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);"> 91</span> <span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 92</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> ?nbsp;BASE64 ~码的字W串 s q行解码</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 128, 128);"> 93</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> String getFromBASE64(String s) {<br /> </span><span style="color: rgb(0, 128, 128);"> 94</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (s </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">)<br /> </span><span style="color: rgb(0, 128, 128);"> 95</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);"> 96</span> <span style="color: rgb(0, 0, 0);">        BASE64Decoder decoder </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> BASE64Decoder();<br /> </span><span style="color: rgb(0, 128, 128);"> 97</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br /> </span><span style="color: rgb(0, 128, 128);"> 98</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] b </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> decoder.decodeBuffer(s);<br /> </span><span style="color: rgb(0, 128, 128);"> 99</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String(b);<br /> </span><span style="color: rgb(0, 128, 128);">100</span> <span style="color: rgb(0, 0, 0);">        } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (Exception e) {<br /> </span><span style="color: rgb(0, 128, 128);">101</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 128, 128);">102</span> <span style="color: rgb(0, 0, 0);">        }<br /> </span><span style="color: rgb(0, 128, 128);">103</span> <span style="color: rgb(0, 0, 0);">    }<br /> </span><span style="color: rgb(0, 128, 128);">104</span> <span style="color: rgb(0, 0, 0);">}</span></div> <br /> <br /> <img src ="http://www.aygfsteel.com/wenhl5656/aggbug/247948.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/wenhl5656/" target="_blank">爱吃鱼头</a> 2008-12-23 17:36 <a href="http://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247948.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java 生成随机序列http://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247947.html爱吃鱼头爱吃鱼头Tue, 23 Dec 2008 09:32:00 GMThttp://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247947.htmlhttp://www.aygfsteel.com/wenhl5656/comments/247947.htmlhttp://www.aygfsteel.com/wenhl5656/archive/2008/12/23/247947.html#Feedback0http://www.aygfsteel.com/wenhl5656/comments/commentRss/247947.htmlhttp://www.aygfsteel.com/wenhl5656/services/trackbacks/247947.html阅读全文

爱吃鱼头 2008-12-23 17:32 发表评论
]]>
Picture Gethttp://www.aygfsteel.com/wenhl5656/archive/2008/09/29/231818.html爱吃鱼头爱吃鱼头Mon, 29 Sep 2008 13:05:00 GMThttp://www.aygfsteel.com/wenhl5656/archive/2008/09/29/231818.htmlhttp://www.aygfsteel.com/wenhl5656/comments/231818.htmlhttp://www.aygfsteel.com/wenhl5656/archive/2008/09/29/231818.html#Feedback4http://www.aygfsteel.com/wenhl5656/comments/commentRss/231818.htmlhttp://www.aygfsteel.com/wenhl5656/services/trackbacks/231818.html    用了(jin)Apache Jakarta Common 下的HttpClient库,把原来的BatchImageFetchE序完全修改?jin)一番,?ch)h的cookie问题l于解决?jin)。Discuz论坛是用cookie验证用户是否dQƈ且时怼(x)更新cookie。在原来初始的代码中Q在socket层面上操作,l护cookie真是一仉?ch)的事情?br />      HttpClient可以自动的处理cookieQƈ且封装cookiec,要手动操作也很方ѝ在实际中发玎ͼ若让HttpClient自动处理cookieQ还是无法维持论坛的d状态的Q因然HttpClient接收?jin)服务器端的的Http响应头中?#8220;Set-cookie”,但ƈ没有Cookie应用到新的请求当中,另外通过用iehttpheaders截包׃(x)发现Qhttpclient?x)在header里构件多个cookie,每一只含有一个cookieQ这同IE是不一L(fng)。IE和Firefox?x)把所有的cookie打包成一个,然后在这个cookie里按照分h每一w开Q中间有个空根{因此,在代码中Q先是获取HttpClient接收到的CookieQ然后再之打包成IE那种形式Q直接设|请求头“CookieQ?...”?br />      用HttClient真的很方便,论坛dQ网下载,囄下蝲Q仅仅几行代码即可,大大的减了(jin)工作量?/p>

爱吃鱼头 2008-09-29 21:05 发表评论
]]>
վ֩ģ壺 | | | ʼ| | ѳ| | ˮ| | ̨| | | | ľ| | | | | Ϫ| | | | | | Ϫ| | | ͭ| ţ| | | ֦| ͭ| Է| Ϫ| | ޭ| | ȫ| | ʻ|