# Class SAMEncoder

java.lang.Object
htsjdk.beta.codecs.reads.sam.SAMEncoder

All Implemented Interfaces:
  `HtsEncoder<SAMFileHeader, SAMRecord>, ReadsEncoder, Closeable, AutoCloseable`

Direct Known Subclasses:
  `SAMEncoderV1_0`

public abstract class SAMEncoder extends Object implements ReadsEncoder
InternalAPI Base class for `BundleResourceType.FMT_READS_SAM` encoders.

## Constructor Summary

Constructors
Constructor
Description
`SAMEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions)`
InternalAPI Create a SAM encoder for the given output bundle.

## Method Summary

Modifier and Type
Method
Description
`final String`
`getDisplayName()`
Get a user-friendly display name for this encoder.
`final String`
`getFileFormat()`
Get the name of the file format supported by this encoder.
`Bundle`
`getOutputBundle()`
Get the output `Bundle` for this encoder.
`ReadsEncoderOptions`
`getReadsEncoderOptions()`
Get the `ReadsEncoderOptions` for this encoder.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface HtsEncoder

`close, getVersion, setHeader, write`

## Constructor Details

### SAMEncoder

public SAMEncoder(Bundle outputBundle, ReadsEncoderOptions readsEncoderOptions)
InternalAPI Create a SAM encoder for the given output bundle. The primary resource in the bundle must have content type `BundleResourceType.CT_ALIGNED_READS` (to find a decoder for a bundle, see `ReadsResolver`). NOTE: callers that provide an output stream resource should provide a buffered output stream if buffering is desired, since the encoder does not provide an additional buffering layer.

Parameters:
  `outputBundle` - output `Bundle` to encode
  `readsEncoderOptions` - `ReadsEncoderOptions` to use

## Method Details

### getFileFormat

public final String getFileFormat()
Description copied from interface: `HtsEncoder`
Get the name of the file format supported by this encoder. The format name defines the underlying format handled by this encoder, and also corresponds to the format of the primary bundle resource that is required when encoding (see `BundleResourceType` and `BundleResource.getFileFormat()`).

Specified by:
  `getFileFormat` in interface `HtsEncoder<SAMFileHeader, SAMRecord>`
Returns:
  the name of the underlying file format handled by this encoder

### getDisplayName

public final String getDisplayName()
Description copied from interface: `HtsEncoder`
Get a user-friendly display name for this encoder.

Specified by:
  `getDisplayName` in interface `HtsEncoder<SAMFileHeader, SAMRecord>`
Returns:
  a user-friendly display name for this encoder for use in error and warning messages

### getOutputBundle

public Bundle getOutputBundle()
Get the output `Bundle` for this encoder.

Returns:
  the output `Bundle` for this encoder

### getReadsEncoderOptions

public ReadsEncoderOptions getReadsEncoderOptions()
Get the `ReadsEncoderOptions` for this encoder.

Returns:
  the `ReadsEncoderOptions` for this encoder.