Package htsjdk.samtools

# Class SAMTextHeaderCodec

java.lang.Object
htsjdk.samtools.SAMTextHeaderCodec

public class SAMTextHeaderCodec extends Object
Parser for a SAM text header, and a generator of SAM text header.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`COMMENT_PREFIX`

## Constructor Summary

Constructors
Constructor
Description
`SAMTextHeaderCodec()`

## Method Summary

Modifier and Type
Method
Description
`SAMFileHeader`
`decode(LineReader reader, String source)`
Reads text SAM header and converts to a SAMFileHeader object.
`void`
`encode(Writer writer, SAMFileHeader header)`
Convert SAMFileHeader from in-memory representation to text representation.
`void`
`encode(Writer writer, SAMFileHeader header, boolean keepExistingVersionNumber)`
Convert SAMFileHeader from in-memory representation to text representation.
`protected String`
`getPGLine(SAMProgramRecord programRecord)`
`protected String`
`getRGLine(SAMReadGroupRecord readGroup)`
`protected String`
`getSQLine(SAMSequenceRecord sequenceRecord)`
`void`
`setValidationStringency(ValidationStringency validationStringency)`

### Methods inherited from class java.lang.Object

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

## Field Details

### COMMENT_PREFIX

public static final String COMMENT_PREFIX

## Constructor Details

### SAMTextHeaderCodec

public SAMTextHeaderCodec()

## Method Details

### decode

public SAMFileHeader decode(LineReader reader, String source)
Reads text SAM header and converts to a SAMFileHeader object.

Parameters:
  `reader` - Where to get header text from.
  `source` - Name of the input file, for error messages. May be null.
Returns:
  complete header object.

### encode

public void encode(Writer writer, SAMFileHeader header)
Convert SAMFileHeader from in-memory representation to text representation. Always writes SAMFileHeader.CURRENT_VERSION as the version in the header.

Parameters:
  `writer` - where to write the header text.
  `header` - object to be converted to text.

### encode

public void encode(Writer writer, SAMFileHeader header, boolean keepExistingVersionNumber)
Convert SAMFileHeader from in-memory representation to text representation.

Parameters:
  `writer` - where to write the header text.
  `header` - object to be converted to text.
  `keepExistingVersionNumber` - If true, writes whatever version # was in the header. If false, writes SAMFileHeader.CURRENT_VERSION.

### getPGLine

protected String getPGLine(SAMProgramRecord programRecord)

### getRGLine

protected String getRGLine(SAMReadGroupRecord readGroup)

### getSQLine

protected String getSQLine(SAMSequenceRecord sequenceRecord)

### setValidationStringency

public void setValidationStringency(ValidationStringency validationStringency)