text: public BytesRef next() throws IOException {if (done) {return null;}if (isFirstLine) {isFirstLine = false;return spare.get();}line = in.readLine();if (line != null) {String[] fields = line.split(fieldDelimiter);if (fields.length > 3) {throw new IllegalArgumentException("More than 3 fields in one line");} else if (fields.length == 3) { spare.copyChars(fields[0]);readWeight(fields[1]);if (hasPayloads) {curPayload.copyChars(fields[2]);}} else if (fields.length == 2) { spare.copyChars(fields[0]);readWeight(fields[1]);if (hasPayloads) { curPayload = new BytesRefBuilder();}} else { spare.copyChars(fields[0]);curWeight = 1;if (hasPayloads) {curPayload = new BytesRefBuilder();}}return spare.get();} else {done = true;IOUtils.close(in);return null;}}