(IntBuffer buf, int[] arr,
boolean wrap)
| 2503 | |
| 2504 | |
| 2505 | protected static IntBuffer updateIntBuffer(IntBuffer buf, int[] arr, |
| 2506 | boolean wrap) { |
| 2507 | if (USE_DIRECT_BUFFERS) { |
| 2508 | if (buf == null || buf.capacity() < arr.length) { |
| 2509 | buf = allocateDirectIntBuffer(arr.length); |
| 2510 | } |
| 2511 | buf.position(0); |
| 2512 | buf.put(arr); |
| 2513 | buf.rewind(); |
| 2514 | } else { |
| 2515 | if (wrap) { |
| 2516 | buf = IntBuffer.wrap(arr); |
| 2517 | } else { |
| 2518 | if (buf == null || buf.capacity() < arr.length) { |
| 2519 | buf = IntBuffer.allocate(arr.length); |
| 2520 | } |
| 2521 | buf.position(0); |
| 2522 | buf.put(arr); |
| 2523 | buf.rewind(); |
| 2524 | } |
| 2525 | } |
| 2526 | return buf; |
| 2527 | } |
| 2528 | |
| 2529 | |
| 2530 | protected static void updateIntBuffer(IntBuffer buf, int[] arr, |
no test coverage detected