(ByteBuffer buf, byte[] arr,
boolean wrap)
| 2319 | |
| 2320 | |
| 2321 | protected static ByteBuffer updateByteBuffer(ByteBuffer buf, byte[] arr, |
| 2322 | boolean wrap) { |
| 2323 | if (USE_DIRECT_BUFFERS) { |
| 2324 | if (buf == null || buf.capacity() < arr.length) { |
| 2325 | buf = allocateDirectByteBuffer(arr.length); |
| 2326 | } |
| 2327 | buf.position(0); |
| 2328 | buf.put(arr); |
| 2329 | buf.rewind(); |
| 2330 | } else { |
| 2331 | if (wrap) { |
| 2332 | buf = ByteBuffer.wrap(arr); |
| 2333 | } else { |
| 2334 | if (buf == null || buf.capacity() < arr.length) { |
| 2335 | buf = ByteBuffer.allocate(arr.length); |
| 2336 | } |
| 2337 | buf.position(0); |
| 2338 | buf.put(arr); |
| 2339 | buf.rewind(); |
| 2340 | } |
| 2341 | } |
| 2342 | return buf; |
| 2343 | } |
| 2344 | |
| 2345 | |
| 2346 | protected static void updateByteBuffer(ByteBuffer buf, byte[] arr, |
no test coverage detected