public void add(BytesRef utf8) { if (closed) throw new IllegalStateException(); buffer.append(utf8); }
/** 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(); }
public BufferingTermFreqIteratorWrapper(TermFreqIterator source) throws IOException { this.comp = source.getComparator(); BytesRef spare; int freqIndex = 0; while((spare = source.next()) != null) { entries.append(spare); if (freqIndex >= freqs.length) { freqs = ArrayUtil.grow(freqs, freqs.length+1); } freqs[freqIndex++] = source.weight(); } }