code: public static VariantFileMetadata readVariantFileMetadata(VariantReader reader, VariantFileMetadata metadata) throws IOException {
          Objects.requireNonNull(reader);
          if (metadata == null) {
              metadata = new VariantFileMetadata("", "");
          }
  
          try {
              reader.open();
              reader.pre();
  
              metadata.setHeader(reader.getVariantFileMetadata().getHeader());
              metadata.setSampleIds(reader.getVariantFileMetadata().getSampleIds());
              metadata.setStats(reader.getVariantFileMetadata().getStats());
  
              reader.post();
          } finally {
              reader.close();
          }
          return metadata;
      }
docs: Reads the VariantSource from a Variant file given an initialized VariantReader
  
  @param reader    Initialized variant reader
  @param metadata    Optional metadata to fill up
  @return          The read variant metadata
  @throws IOException if an I/O error occurs