﻿<?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-文章分类-public</title><link>http://www.blogjava.net/cooperzh/category/50548.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 06 Jan 2012 14:28:55 GMT</lastBuildDate><pubDate>Fri, 06 Jan 2012 14:28:55 GMT</pubDate><ttl>60</ttl><item><title>abstract class MappedByteBuffer extends ByteBuffer</title><link>http://www.blogjava.net/cooperzh/articles/MappedByteBuffer.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Fri, 06 Jan 2012 06:09:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/MappedByteBuffer.html</guid><description><![CDATA[<div>MappedByteBuffer 将文件直接映射到虚拟内存。可以映射整个文件，如果文件太大，可以分段指定映射。<br /><br /><div>通常通过FileChannel.map()方法创建。</div>映射之后，通过MappedByteBuffer 访问文件内容，比到硬盘上去读取文件要快很多。<br /><br /><div>FileChannel.map()方法创建时指定方式：<br /><div><div>MapMode.READ_ONLY，尝试修改缓冲区则报异常ReadOnlyBufferException<div>MapMode.READ_WRITE，共享缓冲区，所有访问的程序都可读可写，但写完是否其他程序立即看到变更，未知<br /><div>MapMode.PRIVATE，创建副本，所有修改对同时访问的其他程序不可见<br /><br />protected：<br />volatile boolean isAMappedBuffer;<br /><div>MappedByteBuffer(int mark,int pos,int lim,int cap,boolean mapped);</div><div>MappedByteBuffer(mark,pos,lim,cap);</div><br />private方法：<br />checkMapped();&nbsp;<br />pagePosition();<br /><br />public final方法：<br /><span style="color: red; ">isLoaded(); 缓存区内容是否处于物理内存中</span><br /><span style="color: red; ">load(); 将缓冲区内容从虚拟内存加载到物理内存</span><br /><span style="color: red; ">force(); 当缓存区是</span><span style="color: red; ">MapMode.READ_WRITE模式时，将缓存区内容写入存储设备中</span><br /><br />private native方法：<br />isLoaded0();<br />load0();<br />force0();<br /><br /><br /><br /><br /><br /><br /><br /><br /></div></div></div></div></div></div><img src ="http://www.blogjava.net/cooperzh/aggbug/368009.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> 2012-01-06 14:09 <a href="http://www.blogjava.net/cooperzh/articles/MappedByteBuffer.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>接口 Readable</title><link>http://www.blogjava.net/cooperzh/articles/Readable.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Fri, 06 Jan 2012 03:01:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/Readable.html</guid><description><![CDATA[<div>Readable是一个字符源<br /><br />public方法：<br />read(CharBuffer); 将字符读入指定的缓冲区</div><img src ="http://www.blogjava.net/cooperzh/aggbug/367991.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> 2012-01-06 11:01 <a href="http://www.blogjava.net/cooperzh/articles/Readable.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>接口 Appendable</title><link>http://www.blogjava.net/cooperzh/articles/Appendable.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Fri, 06 Jan 2012 02:58:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/Appendable.html</guid><description><![CDATA[表示可以向char序列添加字符(有效的Unicode字符)<br /><br />方法有：<br />append(char);<br />append(CharSequence);<br />append(CharSequence csq, int start, int end);<img src ="http://www.blogjava.net/cooperzh/aggbug/367990.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> 2012-01-06 10:58 <a href="http://www.blogjava.net/cooperzh/articles/Appendable.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>接口 Comparable&lt;T&gt;</title><link>http://www.blogjava.net/cooperzh/articles/Comparable.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Thu, 05 Jan 2012 15:54:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/Comparable.html</guid><description><![CDATA[<div><span style="font-size: medium; background-color: #ffffff; "><h3><br /><span class="Apple-style-span" style="font-family: Simsun; line-height: normal; font-weight: normal; ">public 方法</span><br /><span style="font-weight: normal; "><font face="Simsun"><span style="line-height: normal;">compareTo方法：比较两个对象的内容</span></font><br /><font face="Simsun"><span style="line-height: normal;">返回值由实体类具体定义，通常为-1,0,1</span></font><br /><br /><font face="Simsun"><span style="line-height: normal;">实现了该接口的实体类就有了彼此比较的能力</span></font><br /><br /><font face="Simsun"><span style="line-height: normal; ">实现了该接口的实体类的数组，在使用sort()即可实现自动排序。因为sort内部会调用</span></font>compareTo()来比较大小。这就是实现Comparable接口的好处</span></h3></span></div><img src ="http://www.blogjava.net/cooperzh/aggbug/367974.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> 2012-01-05 23:54 <a href="http://www.blogjava.net/cooperzh/articles/Comparable.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>接口 CharSequence</title><link>http://www.blogjava.net/cooperzh/articles/CharSequence.html</link><dc:creator>cooperzh</dc:creator><author>cooperzh</author><pubDate>Thu, 05 Jan 2012 13:24:00 GMT</pubDate><guid>http://www.blogjava.net/cooperzh/articles/CharSequence.html</guid><description><![CDATA[<div>
<div>CharSequence 是 char 值的一个可读序列<br />
<br />
最基本的char存储协议<br />
<br /><h2 style="background-color: #cccccc; ">
方法：</h2><ol><li>charAt(int index);<br />返回长度是序列中16位char的数量</li><li>length();</li><li>subSequence(int start, int end);</li><li>toString();</li></ol></div>
</div><img src ="http://www.blogjava.net/cooperzh/aggbug/367950.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> 2012-01-05 21:24 <a href="http://www.blogjava.net/cooperzh/articles/CharSequence.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><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>