/** * sugar for {@link #iterator(Comparator)} with a <code>null</code> comparator */ public BytesRefIterator iterator() { return iterator(null); }
public BytesRefIterator iterator() { closed = true; return buffer.iterator(comparator); }
/** Sort a single partition in-memory. */ protected File sortPartition(int len) throws IOException { BytesRefList data = this.buffer; File tempFile = File.createTempFile("sort", "partition", tempDirectory); long start = System.currentTimeMillis(); sortInfo.sortTime += (System.currentTimeMillis() - start); final ByteSequencesWriter out = new ByteSequencesWriter(tempFile); BytesRef spare; try { BytesRefIterator iter = buffer.iterator(comparator); while((spare = iter.next()) != null) { assert spare.length <= Short.MAX_VALUE; out.write(spare); } out.close(); // Clean up the buffer for the next partition. data.clear(); return tempFile; } finally { IOUtils.close(out); } }