/** * Constructs an object which will write directly into the output file provided by the stub. * Intentionally delaying the writing of the header -- this should be filled in by the walker. * * <p>Respecs the isCompressed() request in stub, so if isCompressed() is true then this will * create a storage output that dumps output to a BlockCompressedOutputStream. * * @param stub Stub to use when constructing the output file. */ public VariantContextWriterStorage(VariantContextWriterStub stub) { if (stub.getOutputFile() != null) { this.file = stub.getOutputFile(); writer = vcfWriterToFile(stub, stub.getOutputFile(), true, true); } else if (stub.getOutputStream() != null) { this.file = null; this.stream = stub.getOutputStream(); writer = VariantContextWriterFactory.create( stream, stub.getMasterSequenceDictionary(), stub.getWriterOptions(false)); } else throw new ReviewedStingException( "Unable to create target to which to write; storage was provided with neither a file nor a stream."); }