public void parse(Reader in) throws IOException, ParseException {LineNumberReader br = new LineNumberReader(in);try {String line = null;String lastSynSetID = "";CharsRef synset[] = new CharsRef[8];int synsetSize = 0;while ((line = br.readLine()) != null) {String synSetID = line.substring(2, 11);if (!synSetID.equals(lastSynSetID)) {addInternal(synset, synsetSize);synsetSize = 0;}synset = ArrayUtil.grow(synset, synsetSize + 1);synset[synsetSize] = parseSynonym(line, new CharsRefBuilder());synsetSize++;lastSynSetID = synSetID;}addInternal(synset, synsetSize);} catch (IllegalArgumentException e) {ParseException ex = new ParseException("Invalid synonym rule at line " + br.getLineNumber(), 0);ex.initCause(e);throw ex;} finally {br.close();}}

public override void Parse(TextReader @in){int lineNumber = 0;TextReader br = @in;try{string line = null;string lastSynSetID = "";CharsRef[] synset = new CharsRef[8];int synsetSize = 0;while ((line = br.ReadLine()) != null){lineNumber++;string synSetID = line.Substring(2, 9);if (!synSetID.Equals(lastSynSetID, StringComparison.Ordinal)){AddInternal(synset, synsetSize);synsetSize = 0;}if (synset.Length <= synsetSize + 1){CharsRef[] larger = new CharsRef[synset.Length * 2];Array.Copy(synset, 0, larger, 0, synsetSize);synset = larger;}synset[synsetSize] = ParseSynonym(line, synset[synsetSize]);synsetSize++;lastSynSetID = synSetID;}AddInternal(synset, synsetSize);}catch (System.ArgumentException e){throw new Exception("Invalid synonym rule at line " + lineNumber.ToString(), e);}finally{br.Dispose();}}
