src/share/classes/java/nio/Heap-X-Buffer.java.template

Print this page




 122                                      offset);
 123 #else[rw]
 124         return duplicate();
 125 #end[rw]
 126     }
 127 
 128 #if[rw]
 129 
 130     protected int ix(int i) {
 131         return i + offset;
 132     }
 133 
 134     public $type$ get() {
 135         return hb[ix(nextGetIndex())];
 136     }
 137 
 138     public $type$ get(int i) {
 139         return hb[ix(checkIndex(i))];
 140     }
 141 






 142     public $Type$Buffer get($type$[] dst, int offset, int length) {
 143         checkBounds(offset, length, dst.length);
 144         if (length > remaining())
 145             throw new BufferUnderflowException();
 146         System.arraycopy(hb, ix(position()), dst, offset, length);
 147         position(position() + length);
 148         return this;
 149     }
 150 
 151     public boolean isDirect() {
 152         return false;
 153     }
 154 
 155 #end[rw]
 156 
 157     public boolean isReadOnly() {
 158         return {#if[rw]?false:true};
 159     }
 160 
 161     public $Type$Buffer put($type$ x) {




 122                                      offset);
 123 #else[rw]
 124         return duplicate();
 125 #end[rw]
 126     }
 127 
 128 #if[rw]
 129 
 130     protected int ix(int i) {
 131         return i + offset;
 132     }
 133 
 134     public $type$ get() {
 135         return hb[ix(nextGetIndex())];
 136     }
 137 
 138     public $type$ get(int i) {
 139         return hb[ix(checkIndex(i))];
 140     }
 141 
 142 #if[streamableType]
 143     $type$ getUnchecked(int i) {
 144         return hb[ix(i)];
 145     }
 146 #end[streamableType]
 147 
 148     public $Type$Buffer get($type$[] dst, int offset, int length) {
 149         checkBounds(offset, length, dst.length);
 150         if (length > remaining())
 151             throw new BufferUnderflowException();
 152         System.arraycopy(hb, ix(position()), dst, offset, length);
 153         position(position() + length);
 154         return this;
 155     }
 156 
 157     public boolean isDirect() {
 158         return false;
 159     }
 160 
 161 #end[rw]
 162 
 163     public boolean isReadOnly() {
 164         return {#if[rw]?false:true};
 165     }
 166 
 167     public $Type$Buffer put($type$ x) {