code: public static void convert(SequenceRecordReader reader, SequenceRecordWriter writer, boolean closeOnCompletion) throws IOException {
  
          if(!reader.hasNext()){
              throw new UnsupportedOperationException("Cannot convert SequenceRecordReader: reader has no next element");
          }
  
          while(reader.hasNext()){
              writer.write(reader.sequenceRecord());
          }
  
          if(closeOnCompletion){
              writer.close();
          }
      }
docs: Write all sequences from the specified sequence record reader to the specified sequence record writer.
  Closes the sequence record writer on completion.
  
  @param reader Sequence record reader (source of data)
  @param writer Sequence record writer (location to write data)
  @param closeOnCompletion if true: close the record writer once complete, via {@link SequenceRecordWriter#close()}
  @throws IOException If underlying reader/writer throws an exception