Posted on 2011-12-31 11:13
cooperzh 閱讀(174)
評論(0) 編輯 收藏 所屬分類:
java.nio.*; 、
public 、
類
java.nio.buffer
public final 方法
- capacity()
- position()
- postition(int)
- limit()
- limit(int)
- mark()
- reset()
- clear()
- flip()
- rewind()
- remaining()
- hasremaining()
總結:這些是Buffer作為容器的基本特征,與內部放的內容無關
public abstract 方法
- isReadOnly()
- hasArray()
- array()
- arrayOffset()
- isDirect()
這些方法等待子類進行覆寫
protected final 方法
- nextGetIndex()
- nextGetIndex(int)
- nextPutIndex()
- nextPutIndex(int)
- checkIndex(int)
- checkIndex(int,int)
- markValue()
總結:這些方法僅供子類內部使用
protected 方法
checkBounds(int off, int len, int size);
判斷是否同時存在:off>=0, len>=0, (off+len)>=size,不存在則報IndexOutOfBoundsException異常
實際上還要同時保證(off+len)不能超過Integer.MAX_VALUE而變為負數