Package htsjdk.samtools

# Interface SAMFileWriter

All Superinterfaces:
  `AutoCloseable`, `Closeable`

All Known Implementing Classes:
  `BAMFileWriter`, `CRAMFileWriter`, `SAMFileWriterImpl`, `SAMTextWriter`

public interface SAMFileWriter extends Closeable
Interface for SAMText and BAM file writers. Clients need not care which they write to, once the object is constructed.

## Method Summary

Modifier and Type
Method
Description
`void`
`addAlignment(SAMRecord alignment)`
`void`
`close()`
Must be called to flush or file will likely be defective.
`SAMFileHeader`
`getFileHeader()`
`void`
`setProgressLogger(ProgressLoggerInterface progress)`
Sets a ProgressLogger on this writer.
`default void`
`setSortOrderChecking(boolean check)`
If true writers that are writing pre-sorted records should check the order during writing.

## Method Details

### addAlignment

void addAlignment(SAMRecord alignment)

### getFileHeader

SAMFileHeader getFileHeader()

### setProgressLogger

void setProgressLogger(ProgressLoggerInterface progress)
Sets a ProgressLogger on this writer. This is useful when pulling, for instance, from a SortingCollection.

### setSortOrderChecking

default void setSortOrderChecking(boolean check)
If true writers that are writing pre-sorted records should check the order during writing.

### close

void close()
Must be called to flush or file will likely be defective.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`