(ShortBuffer buf, short[] arr,
boolean wrap)
| 2469 | |
| 2470 | |
| 2471 | protected static ShortBuffer updateShortBuffer(ShortBuffer buf, short[] arr, |
| 2472 | boolean wrap) { |
| 2473 | if (USE_DIRECT_BUFFERS || (buf != null && buf.isDirect())) { |
| 2474 | if (buf == null || buf.capacity() < arr.length) { |
| 2475 | buf = allocateDirectShortBuffer(arr.length); |
| 2476 | } |
| 2477 | buf.position(0); |
| 2478 | buf.put(arr); |
| 2479 | buf.rewind(); |
| 2480 | } else { |
| 2481 | if (wrap) { |
| 2482 | buf = ShortBuffer.wrap(arr); |
| 2483 | } else { |
| 2484 | if (buf == null || buf.capacity() < arr.length) { |
| 2485 | buf = ShortBuffer.allocate(arr.length); |
| 2486 | } |
| 2487 | buf.position(0); |
| 2488 | buf.put(arr); |
| 2489 | buf.rewind(); |
| 2490 | } |
| 2491 | } |
| 2492 | return buf; |
| 2493 | } |
| 2494 | |
| 2495 | |
| 2496 | protected static void updateShortBuffer(ShortBuffer buf, short[] arr, |
no test coverage detected