﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-cooperzh-文章分类-java.nio.*;</title><link>http://www.blogjava.net/cooperzh/category/50516.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 06 Jan 2012 21:32:24 GMT</lastBuildDate><pubDate>Fri, 06 Jan 2012 21:32:24 GMT</pubDate><ttl>60</ttl><item><title>abstract class Buffer</title><link>http://www.blogjava.net/cooperzh/articles/Buffer.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Sat, 31 Dec 2011 03:13:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/Buffer.html</guid><description><![CDATA[<div style="border-image: initial; ">java.nio.buffer<br />
<br />
<p style="border-image: initial; background-color: #dcdcdc; ">public final 方法<br />
</p>
<ul>
     <li>capacity()</li>
     <li>position()</li>
     <li>postition(int)</li>
     <li>limit()</li>
     <li>limit(int)</li>
     <li>mark()</li>
     <li>reset()</li>
     <li>clear()</li>
     <li>flip()</li>
     <li>rewind()</li>
     <li>remaining()</li>
     <li>hasremaining()<br />
     </li>
</ul>
总结：这些是Buffer作为容器的基本特征，与内部放的内容无关<br /><br />
<p style="background-color: #cccccc; ">public abstract 方法</p>
<ul>
     <li>isReadOnly()</li>
     <li>hasArray()</li>
     <li>array()</li>
     <li>arrayOffset()</li>
     <li>isDirect()<br />
     <br />
     </li>
</ul>这些方法等待子类进行覆写<br /><br />
<p style="background-color: #cccccc; ">protected final 方法</p>
<ul>
     <li>nextGetIndex()</li>
     <li>nextGetIndex(int)</li>
     <li>nextPutIndex()</li>
     <li>nextPutIndex(int)</li>
     <li>checkIndex(int)</li>
     <li>checkIndex(int,int)</li>
     <li>markValue()</li>
</ul>
总结：这些方法仅供子类内部使用<br />
<br />protected 方法<br /><div>checkBounds(int off, int len, int size);</div>判断是否同时存在：off&gt;=0, len&gt;=0, (off+len)&gt;=size，不存在则报IndexOutOfBoundsException异常<br />实际上还要同时保证(off+len)不能超过Integer.MAX_VALUE而变为负数<br />
<br />
<br />
</div><img src ="http://www.blogjava.net/cooperzh/aggbug/367626.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cooperzh/" target="_blank">cooperzh</a> 2011-12-31 11:13 <a href="http://www.blogjava.net/cooperzh/articles/Buffer.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>