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;}}

public BytesRef Next(){if (outerInstance.done){return null;}if (isFirstLine){isFirstLine = false;return spare;}outerInstance.line = outerInstance.@in.ReadLine();if (outerInstance.line != null){string[] fields = outerInstance.line.Split(new string[] { outerInstance.fieldDelimiter }, StringSplitOptions.RemoveEmptyEntries);if (fields.Length > 3){throw new System.ArgumentException("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 BytesRef();}} else{spare.CopyChars(fields[0]);curWeight = 1;if (hasPayloads){curPayload = new BytesRef();}}return spare;}else{outerInstance.done = true;IOUtils.Dispose(outerInstance.@in);return null;}}
