348 results[1]++; // matched bytes
349 }
350 }
351
352 return results;
353 }
354
355 /*
356 * Override the actual write below. We do things this way to be
357 * consistent with InputRecord. InputRecord may try to write out
358 * data to the peer, and *then* throw an Exception. This forces
359 * data to be generated/output before the exception is ever
360 * generated.
361 */
362 @Override
363 void writeBuffer(OutputStream s, byte [] buf, int off, int len)
364 throws IOException {
365 /*
366 * Copy data out of buffer, it's ready to go.
367 */
368 ByteBuffer netBB = (ByteBuffer)
369 (ByteBuffer.allocate(len).put(buf, 0, len).flip());
370 engine.writer.putOutboundDataSync(netBB);
371 }
372
373 /*
374 * Delineate or read a complete packet from src.
375 *
376 * If internal data (hs, alert, ccs), the data is read and
377 * stored internally.
378 *
379 * If external data (app), return a new ByteBuffer which points
380 * to the data to process.
381 */
382 ByteBuffer read(ByteBuffer srcBB) throws IOException {
383 /*
384 * Could have a src == null/dst == null check here,
385 * but that was already checked by SSLEngine.unwrap before
386 * ever attempting to read.
387 */
388
389 /*
|
348 results[1]++; // matched bytes
349 }
350 }
351
352 return results;
353 }
354
355 /*
356 * Override the actual write below. We do things this way to be
357 * consistent with InputRecord. InputRecord may try to write out
358 * data to the peer, and *then* throw an Exception. This forces
359 * data to be generated/output before the exception is ever
360 * generated.
361 */
362 @Override
363 void writeBuffer(OutputStream s, byte [] buf, int off, int len)
364 throws IOException {
365 /*
366 * Copy data out of buffer, it's ready to go.
367 */
368 ByteBuffer netBB = ByteBuffer.allocate(len).put(buf, 0, len).flip();
369 engine.writer.putOutboundDataSync(netBB);
370 }
371
372 /*
373 * Delineate or read a complete packet from src.
374 *
375 * If internal data (hs, alert, ccs), the data is read and
376 * stored internally.
377 *
378 * If external data (app), return a new ByteBuffer which points
379 * to the data to process.
380 */
381 ByteBuffer read(ByteBuffer srcBB) throws IOException {
382 /*
383 * Could have a src == null/dst == null check here,
384 * but that was already checked by SSLEngine.unwrap before
385 * ever attempting to read.
386 */
387
388 /*
|