/** Read in a single partition of data */ int readPartition(ByteSequencesReader reader) throws IOException { long start = System.currentTimeMillis(); final BytesRef scratch = new BytesRef(); while ((scratch.bytes = reader.read()) != null) { scratch.length = scratch.bytes.length; buffer.append(scratch); // Account for the created objects. // (buffer slots do not account to buffer size.) if (ramBufferSize.bytes < buffer.bytesUsed()) { break; } } sortInfo.readTime += (System.currentTimeMillis() - start); return buffer.size(); }