(ShortBuffer buf, short[] arr,
boolean wrap)
| 2411 | |
| 2412 | |
| 2413 | protected static ShortBuffer updateShortBuffer(ShortBuffer buf, short[] arr, |
| 2414 | boolean wrap) { |
| 2415 | if (USE_DIRECT_BUFFERS) { |
| 2416 | if (buf == null || buf.capacity() < arr.length) { |
| 2417 | buf = allocateDirectShortBuffer(arr.length); |
| 2418 | } |
| 2419 | buf.position(0); |
| 2420 | buf.put(arr); |
| 2421 | buf.rewind(); |
| 2422 | } else { |
| 2423 | if (wrap) { |
| 2424 | buf = ShortBuffer.wrap(arr); |
| 2425 | } else { |
| 2426 | if (buf == null || buf.capacity() < arr.length) { |
| 2427 | buf = ShortBuffer.allocate(arr.length); |
| 2428 | } |
| 2429 | buf.position(0); |
| 2430 | buf.put(arr); |
| 2431 | buf.rewind(); |
| 2432 | } |
| 2433 | } |
| 2434 | return buf; |
| 2435 | } |
| 2436 | |
| 2437 | |
| 2438 | protected static void updateShortBuffer(ShortBuffer buf, short[] arr, |
no test coverage detected