java.nio.Buffer
属性
mark | |
position | |
limit | 一般情况下limit==catacity |
capacity | 此属性一经设置,就不会改变 |
remaing | limit-position |
address |
查询类方法
remaining | limit - position; |
hasRemaining | limit < position; |
改变类方法
mark | mark=position; |
reset | position=mark; |
clear | position=0; limit=capacity; mark=-1; |
flip | limit=position; position=0; mark=-1; |
rewind | position=0; mark=-1; |
limit() | limit=newLimit;
if (position > limit) position = limit; if (mark > limit) mark = -1;
|
position() | position = newPosition;
if (mark > position) mark = -1; |
System.arraycopy(hb, ix(position()), hb, ix(0), remaining());
position(remaining());
limit(capacity());
compact | |
slice | new HeapIntBuffer(hb, -1, 0, this.remaining(), this.remaining(), this.position() + offset);
|
duplicate | new HeapByteBuffer(hb,
this.markValue(), this.position(), this.limit(), this.capacity(), offset);
|