MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / AsyncVcfWriter

Class AsyncVcfWriter

src/main/java/com/rtg/vcf/AsyncVcfWriter.java:44–86  ·  view source on GitHub ↗

Adaptor that allows asynchronous writing of our VcfRecord objects.

Source from the content-addressed store, hash-verified

42 * Adaptor that allows asynchronous writing of our VcfRecord objects.
43 */
44public class AsyncVcfWriter extends AbstractAsyncWriter<VcfRecord> implements VcfWriter {
45
46 private static final int BUFFER_SIZE = GlobalFlags.getIntegerValue(ToolsGlobalFlags.VCF_ASYNC_BUFFER_SIZE);
47
48 private final VcfWriter mWriter;
49
50 /**
51 * Constructor
52 * @param w the inner VcfWriter
53 */
54 public AsyncVcfWriter(VcfWriter w) {
55 super(BUFFER_SIZE);
56 mWriter = w;
57 }
58
59 @Override
60 public VcfHeader getHeader() {
61 return mWriter.getHeader();
62 }
63
64 @Override
65 protected String getThreadNamePrefix() {
66 return "VcfWriter";
67 }
68
69 @Override
70 protected void synchronouslyWrite(VcfRecord record) {
71 try {
72 mWriter.write(record);
73 } catch (IOException e) {
74 throw new RuntimeIOException(e);
75 }
76 }
77
78 @Override
79 protected void synchronouslyClose() {
80 try {
81 mWriter.close();
82 } catch (IOException e) {
83 throw new RuntimeIOException(e);
84 }
85 }
86}

Callers

nothing calls this directly

Calls 1

getIntegerValueMethod · 0.95

Tested by

no test coverage detected