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