ensureBufferCapacity(accumulatedRecordBytes + toCopy); segment.get(segmentPosition, buffer, this.accumulatedRecordBytes, toCopy);
this.spillingChannel = createSpillingChannel(); } else { ensureBufferCapacity(this.recordLength);
this.spillingChannel = createSpillingChannel(); } else { ensureBufferCapacity(this.recordLength);
private void initializeWithPartialRecord(NonSpanningWrapper partial, int nextRecordLength) throws IOException { // set the length and copy what is available to the buffer this.recordLength = nextRecordLength; final int numBytesChunk = partial.remaining(); if (nextRecordLength > THRESHOLD_FOR_SPILLING) { // create a spilling channel and put the data there this.spillingChannel = createSpillingChannel(); ByteBuffer toWrite = partial.segment.wrap(partial.position, numBytesChunk); FileUtils.writeCompletely(this.spillingChannel, toWrite); } else { // collect in memory ensureBufferCapacity(nextRecordLength); partial.segment.get(partial.position, buffer, 0, numBytesChunk); } this.accumulatedRecordBytes = numBytesChunk; }
private void initializeWithPartialRecord(NonSpanningWrapper partial, int nextRecordLength) throws IOException { // set the length and copy what is available to the buffer this.recordLength = nextRecordLength; final int numBytesChunk = partial.remaining(); if (nextRecordLength > THRESHOLD_FOR_SPILLING) { // create a spilling channel and put the data there this.spillingChannel = createSpillingChannel(); ByteBuffer toWrite = partial.segment.wrap(partial.position, numBytesChunk); this.spillingChannel.write(toWrite); } else { // collect in memory ensureBufferCapacity(numBytesChunk); partial.segment.get(partial.position, buffer, 0, numBytesChunk); } this.accumulatedRecordBytes = numBytesChunk; }
private void initializeWithPartialRecord(NonSpanningWrapper partial, int nextRecordLength) throws IOException { // set the length and copy what is available to the buffer this.recordLength = nextRecordLength; final int numBytesChunk = partial.remaining(); if (nextRecordLength > THRESHOLD_FOR_SPILLING) { // create a spilling channel and put the data there this.spillingChannel = createSpillingChannel(); ByteBuffer toWrite = partial.segment.wrap(partial.position, numBytesChunk); FileUtils.writeCompletely(this.spillingChannel, toWrite); } else { // collect in memory ensureBufferCapacity(nextRecordLength); partial.segment.get(partial.position, buffer, 0, numBytesChunk); } this.accumulatedRecordBytes = numBytesChunk; }