private void init( OutputStream output, SAMFileHeader header, boolean writeHeader) throws IOException { this.header = header; writer = new SAMTextWriter(output); writer.setSortOrder(header.getSortOrder(), false); if (writeHeader) writer.setHeader(header); }
private void init( OutputStream output, SAMFileHeader header, boolean writeHeader) throws IOException { this.header = header; writer = new SAMTextWriter(output); writer.setSortOrder(header.getSortOrder(), false); if (writeHeader) writer.setHeader(header); }
private void init( OutputStream output, SAMFileHeader header, boolean writeHeader) throws IOException { this.header = header; writer = new SAMTextWriter(output); writer.setSortOrder(header.getSortOrder(), false); if (writeHeader) writer.setHeader(header); }
/** * Create a SAMTextWriter that is ready to receive SAMRecords. * @param header entire header. Sort order is determined by the sortOrder property of this arg. * @param presorted if true, SAMRecords must be added to the SAMFileWriter in order that agrees with header.sortOrder. * @param outputFile where to write the output. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final File outputFile) { try { final SAMTextWriter ret = this.createMd5File ? new SAMTextWriter(new Md5CalculatingOutputStream(new FileOutputStream(outputFile, false), new File(outputFile.getAbsolutePath() + ".md5"))) : new SAMTextWriter(outputFile); ret.setSortOrder(header.getSortOrder(), presorted); if (maxRecordsInRam != null) { ret.setMaxRecordsInRam(maxRecordsInRam); } ret.setHeader(header); if (this.useAsyncIo) return new AsyncSAMFileWriter(ret, this.asyncOutputBufferSize); else return ret; } catch (final IOException ioe) { throw new RuntimeIOException("Error opening file: " + outputFile.getAbsolutePath()); } }
public static SAMFileWriter createSAMTextWriter(SAMFileWriterFactory factoryOrNull, OutputStream os, SAMFileHeader header, boolean printHeader) throws IOException { SAMFileWriter writer = null; if (printHeader) { if (factoryOrNull == null) factoryOrNull = new SAMFileWriterFactory(); writer = factoryOrNull.makeSAMWriter(header, true, os); } else { SwapOutputStream sos = new SwapOutputStream(); final SAMTextWriter ret = new SAMTextWriter(sos); ret.setSortOrder(header.getSortOrder(), true); ret.setHeader(header); ret.getWriter().flush(); writer = ret; sos.delegate = os; } return writer; }