@Override protected void writeRead(byte[] name, int flags, byte[] bases, byte[] scores) { FastqRead read = new FastqRead(readLength, name, appendSegmentIndexToReadNames, getSegmentIndexInTemplate(flags), bases, scores); read.generation = generation++; if (read.templateIndex == 0) { try { write(read, streams[0]); counter++; } catch (IOException e) { throw new RuntimeException(e); } return; } if (readSet.containsKey(read)) { foundCollision(read); } else { readSet.put(read, read); if (readSet.size() > maxCacheSize) purgeCache(); } }