149 |
|
|
150 |
return backing_buffer [(pos++) + array_offset]; |
return backing_buffer [(pos++) + array_offset]; |
151 |
} |
} |
152 |
|
|
153 |
|
/** |
154 |
|
* Bulk get |
155 |
|
*/ |
156 |
|
public ByteBuffer get (byte[] dst, int offset, int length) |
157 |
|
{ |
158 |
|
checkArraySize(dst.length, offset, length); |
159 |
|
if ( (limit - pos) < length) // check for overflow |
160 |
|
throw new BufferUnderflowException(); |
161 |
|
|
162 |
|
System.arraycopy(backing_buffer, pos + array_offset, |
163 |
|
dst, offset, length); |
164 |
|
pos += length; |
165 |
|
|
166 |
|
return this; |
167 |
|
} |
168 |
|
|
169 |
|
/** |
170 |
|
* Relative bulk put(), overloads the ByteBuffer impl. |
171 |
|
*/ |
172 |
|
public ByteBuffer put (byte[] src, int offset, int length) |
173 |
|
{ |
174 |
|
if ( (limit - pos) < length) // check for overflow |
175 |
|
throw new BufferOverflowException(); |
176 |
|
checkArraySize(src.length, offset, length); |
177 |
|
|
178 |
|
System.arraycopy(src, offset, backing_buffer, pos + array_offset, length); |
179 |
|
pos += length; |
180 |
|
|
181 |
|
return this; |
182 |
|
} |
183 |
|
|
184 |
/** |
/** |
185 |
* Relative put method. Writes <code>value</code> to the next position |
* Relative put method. Writes <code>value</code> to the next position |
186 |
* in the buffer. |
* in the buffer. |
238 |
|
|
239 |
public ByteBuffer putChar (char value) |
public ByteBuffer putChar (char value) |
240 |
{ |
{ |
241 |
ByteBufferHelper.putChar(this, value, order()); |
if (readOnly) |
242 |
|
throw new ReadOnlyBufferException (); |
243 |
|
if ( (limit-pos) < 2) |
244 |
|
throw new BufferOverflowException(); |
245 |
|
|
246 |
|
if (endian == ByteOrder.LITTLE_ENDIAN) |
247 |
|
{ |
248 |
|
backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF); |
249 |
|
backing_buffer [(pos++) + array_offset] = (byte)(value>>8); |
250 |
|
} |
251 |
|
else |
252 |
|
{ |
253 |
|
backing_buffer [(pos++) + array_offset] = (byte)(value>>8); |
254 |
|
backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF); |
255 |
|
} |
256 |
return this; |
return this; |
257 |
} |
} |
258 |
|
|