(ByteBuffer len, ByteBuffer arr, ByteBuffer d, int fp)
| 320 | } |
| 321 | |
| 322 | private void write(ByteBuffer len, ByteBuffer arr, ByteBuffer d, int fp) throws IOException { |
| 323 | // write the data into the buffer, flushing if necessary |
| 324 | if (writeBuffer.capacity() < fp) { |
| 325 | // can't use the write buffer, flush pending and write it explicitly. |
| 326 | flushBuffer(); |
| 327 | ByteBuffer tmp = ByteBuffer.allocateDirect(fp); |
| 328 | tmp.put(len); |
| 329 | tmp.put(arr); |
| 330 | tmp.put(d); |
| 331 | tmp.flip(); |
| 332 | flushBuffer(tmp); |
| 333 | } else { |
| 334 | if (writeBuffer.remaining() < fp) { |
| 335 | // no room at the inn. flush and go. |
| 336 | flushBuffer(); |
| 337 | } |
| 338 | // actually append the 3 parts to the buffer, inc the counter. |
| 339 | writeBuffer.put(len); |
| 340 | writeBuffer.put(arr); |
| 341 | writeBuffer.put(d); |
| 342 | pendingWrites++; |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | private void writeFully(ByteBuffer b, long pos) throws IOException { |
| 347 | while (b.hasRemaining()) { |
no test coverage detected