posts - 12, comments - 0, trackbacks - 0, articles - 7
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          abstract class Buffer

          Posted on 2011-12-31 11:13 cooperzh 閱讀(179) 評論(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而變為負數


          主站蜘蛛池模板: 大埔区| 郴州市| 舒城县| 兰溪市| 应用必备| 崇左市| 长海县| 宜宾县| 阜南县| 江北区| 岳普湖县| 高密市| 宁都县| 三台县| 独山县| 桂东县| 清新县| 湛江市| 长宁区| 高碑店市| 安溪县| 闽侯县| 尚义县| 安仁县| 昆山市| 达州市| 耒阳市| 二手房| 济源市| 昂仁县| 库伦旗| 兴文县| 景东| 宝应县| 禹城市| 江达县| 永宁县| 阿城市| 永年县| 无锡市| 灵石县|