### Question:
VCFExporter implements Closeable { public void export(Variant variant) { export(Iterators.singletonIterator(variant)); } VCFExporter(VariantStudyMetadata metadata); void export(Variant variant); void export(List<Variant> variants); void export(Iterator<Variant> iterator); void open(Path outPath, Options... writerOptions); void open(OutputStream os, Options... writerOptions); void close(); List<String> getSampleNames(); void setSampleNames(List<String> sampleNames); List<String> getFormats(); void setFormats(List<String> formats); List<String> getAnnotations(); void setAnnotations(List<String> annotations);  }### Answer:
@Test public void export() throws Exception { VariantStudyMetadata metadata = new VariantFileMetadata("1", "test.vcf").toVariantStudyMetadata("study"); VariantVcfHtsjdkReader reader = new VariantVcfHtsjdkReader(getClass().getResourceAsStream("/test.vcf"), metadata); reader.open(); reader.pre(); VCFExporter exporter = new VCFExporter(metadata); Options writerOptions = Options.USE_ASYNC_IO; exporter.open(outPath, writerOptions); List<Variant> read = reader.read(); while (read != null && !read.isEmpty()) { exporter.export(read); read = reader.read(); } exporter.close(); reader.post(); reader.close(); }