Source:
<code>private void assertBlobReadSuccess(GetBlobOptions options, Future<Long> readIntoFuture, ByteBufferAsyncWritableChannel asyncWritableChannel, ReadableStreamChannel readableStreamChannel, CountDownLatch readCompleteLatch, AtomicLong readCompleteResult, AtomicReference<Throwable> readCompleteThrowable) { try { ByteBuffer putContentBuf; if (options != null && options.isRawMode()) { putContentBuf = getBlobBuffer(); Assert.assertNotNull("Did not find server with blob: " + blobIdStr, putContentBuf); } else { putContentBuf = ByteBuffer.wrap(putContent); if (options != null) { if (options.getBlobSegment() != NO_BLOB_SEGMENT_IDX_SPECIFIED) { <START> <END> } if (options.getRange() != null) { ByteRange range = options.getRange().toResolvedByteRange(blobSize); putContentBuf = ByteBuffer.wrap(putContent, (int) range.getStartOffset(), (int) range.getRangeSize()); } } } long written; Assert.assertTrue("ReadyForPollCallback should have been invoked as readInto() was called", mockNetworkClient.getAndClearWokenUpStatus()); final int bytesToRead = putContentBuf.remaining(); int readBytes = 0; do { ByteBuffer buf = asyncWritableChannel.getNextChunk(); int bufLength = buf.remaining(); Assert.assertTrue("total content read should not be greater than length of put content", readBytes + bufLength <= bytesToRead); while (buf.hasRemaining()) { Assert.assertEquals("Get and Put blob content should match", putContentBuf.get(), buf.get()); readBytes++; } asyncWritableChannel.resolveOldestChunk(null); Assert.assertTrue("ReadyForPollCallback should have been invoked as writable channel callback was called", mockNetworkClient.getAndClearWokenUpStatus()); } while (readBytes < bytesToRead); written = readIntoFuture.get(); Assert.assertEquals("the returned length in the future should be the length of data written", (long) readBytes, written); Assert.assertNull("There should be no more data in the channel", asyncWritableChannel.getNextChunk(0)); readableStreamChannel.close(); readCompleteResult.set(written); } catch (Throwable e) { readCompleteThrowable.set(e); } finally { readCompleteLatch.countDown(); } }</code><technical_language>do here</technical_language>

Target:
private void assertBlobReadSuccess(GetBlobOptions options, Future<Long> readIntoFuture, ByteBufferAsyncWritableChannel asyncWritableChannel, ReadableStreamChannel readableStreamChannel, CountDownLatch readCompleteLatch, AtomicLong readCompleteResult, AtomicReference<Throwable> readCompleteThrowable) { try { ByteBuffer putContentBuf; if (options != null && options.isRawMode()) { putContentBuf = getBlobBuffer(); Assert.assertNotNull("Did not find server with blob: " + blobIdStr, putContentBuf); } else { putContentBuf = ByteBuffer.wrap(putContent); if (options != null && options.getRange() != null) { ByteRange range = options.getRange().toResolvedByteRange(blobSize); putContentBuf = ByteBuffer.wrap(putContent, (int) range.getStartOffset(), (int) range.getRangeSize()); } } long written; Assert.assertTrue("ReadyForPollCallback should have been invoked as readInto() was called", mockNetworkClient.getAndClearWokenUpStatus()); final int bytesToRead = putContentBuf.remaining(); int readBytes = 0; do { ByteBuffer buf = asyncWritableChannel.getNextChunk(); int bufLength = buf.remaining(); Assert.assertTrue("total content read should not be greater than length of put content", readBytes + bufLength <= bytesToRead); while (buf.hasRemaining()) { Assert.assertEquals("Get and Put blob content should match", putContentBuf.get(), buf.get()); readBytes++; } asyncWritableChannel.resolveOldestChunk(null); Assert.assertTrue("ReadyForPollCallback should have been invoked as writable channel callback was called", mockNetworkClient.getAndClearWokenUpStatus()); } while (readBytes < bytesToRead); written = readIntoFuture.get(); Assert.assertEquals("the returned length in the future should be the length of data written", (long) readBytes, written); Assert.assertNull("There should be no more data in the channel", asyncWritableChannel.getNextChunk(0)); readableStreamChannel.close(); readCompleteResult.set(written); } catch (Throwable e) { readCompleteThrowable.set(e); } finally { readCompleteLatch.countDown(); } }