/** * Create a SAMTextWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { return initWriter(header, presorted, false, new SAMTextWriter(stream)); }
/** * Create a BAMFileWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeBAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { return initWriter(header, presorted, true, new BAMFileWriter(stream, null)); }
/** * Create a SAMTextWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { /** * Use the value specified from Defaults.SAM_FLAG_FIELD_FORMAT when samFlagFieldOutput value has not been set. This should * be samFlagFieldOutput.DECIMAL when the user has not set Defaults.SAM_FLAG_FIELD_FORMAT. */ if (samFlagFieldOutput == SamFlagField.NONE) { samFlagFieldOutput = Defaults.SAM_FLAG_FIELD_FORMAT; } return initWriter(header, presorted, new SAMTextWriter(stream, samFlagFieldOutput)); }
/** * Create a SAMTextWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { /** * Use the value specified from Defaults.SAM_FLAG_FIELD_FORMAT when samFlagFieldOutput value has not been set. This should * be samFlagFieldOutput.DECIMAL when the user has not set Defaults.SAM_FLAG_FIELD_FORMAT. */ if (samFlagFieldOutput == SamFlagField.NONE) { samFlagFieldOutput = Defaults.SAM_FLAG_FIELD_FORMAT; } return initWriter(header, presorted, new SAMTextWriter(stream, samFlagFieldOutput)); }
/** * Create a BAMFileWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeBAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { return initWriter(header, presorted, new BAMFileWriter(stream, (File)null, this.getCompressionLevel(), this.deflaterFactory)); }
/** * Create a BAMFileWriter for writing to a stream that is ready to receive SAMRecords. * This method does not support the creation of an MD5 file * * @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 stream the stream to write records to. Note that this method does not buffer the stream, so the * caller must buffer if desired. Note that PrintStream is buffered. */ public SAMFileWriter makeBAMWriter(final SAMFileHeader header, final boolean presorted, final OutputStream stream) { return initWriter(header, presorted, new BAMFileWriter(stream, (File)null, this.getCompressionLevel(), this.deflaterFactory)); }
/** * 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 outputPath where to write the output. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final Path outputPath) { /** * Use the value specified from Defaults.SAM_FLAG_FIELD_FORMAT when samFlagFieldOutput value has not been set. This should * be SamFlagField.DECIMAL when the user has not set Defaults.SAM_FLAG_FIELD_FORMAT. */ if (samFlagFieldOutput == SamFlagField.NONE) { samFlagFieldOutput = Defaults.SAM_FLAG_FIELD_FORMAT; } try { final SAMTextWriter ret = this.createMd5File ? new SAMTextWriter(new Md5CalculatingOutputStream(Files.newOutputStream(outputPath), IOUtil.addExtension(outputPath, ".md5")), samFlagFieldOutput) : new SAMTextWriter(null == outputPath ? null : Files.newOutputStream(outputPath), samFlagFieldOutput); return initWriter(header, presorted, ret); } catch (final IOException ioe) { throw new RuntimeIOException("Error opening file: " + outputPath.toUri(), ioe); } }
/** * 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 outputPath where to write the output. */ public SAMFileWriter makeSAMWriter(final SAMFileHeader header, final boolean presorted, final Path outputPath) { /** * Use the value specified from Defaults.SAM_FLAG_FIELD_FORMAT when samFlagFieldOutput value has not been set. This should * be SamFlagField.DECIMAL when the user has not set Defaults.SAM_FLAG_FIELD_FORMAT. */ if (samFlagFieldOutput == SamFlagField.NONE) { samFlagFieldOutput = Defaults.SAM_FLAG_FIELD_FORMAT; } try { final SAMTextWriter ret = this.createMd5File ? new SAMTextWriter(new Md5CalculatingOutputStream(Files.newOutputStream(outputPath), IOUtil.addExtension(outputPath, ".md5")), samFlagFieldOutput) : new SAMTextWriter(null == outputPath ? null : Files.newOutputStream(outputPath), samFlagFieldOutput); return initWriter(header, presorted, ret); } catch (final IOException ioe) { throw new RuntimeIOException("Error opening file: " + outputPath.toUri(), ioe); } }