text: public BytesRef Next(){if (done){return null;}bool success = false;BytesRef result;try{string line;if ((line = outerInstance.@in.ReadLine()) != null){spare.CopyChars(line);result = spare;}else{done = true;IOUtils.Dispose(outerInstance.@in);result = null;}success = true;}finally{if (!success){IOUtils.DisposeWhileHandlingException(outerInstance.@in);}}return result;}