# Class FastqEncoder

java.lang.Object
htsjdk.samtools.fastq.FastqEncoder

public final class FastqEncoder extends Object
Codec for encoding records into FASTQ format.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final BiConsumer<FastqRecord, SAMRecord>`
`QUALITY_HEADER_PARSE_SAM_TAGS`
`static final BiConsumer<FastqRecord, SAMRecord>`
`QUALITY_HEADER_TO_COMMENT_TAG`
Encodes the quality header into the comment tag (use in `asSAMRecord(FastqRecord, SAMFileHeader, BiConsumer)`.

## Method Summary

Modifier and Type
Method
Description
`static FastqRecord`
`asFastqRecord(SAMRecord record)`
Converts a `SAMRecord` into a `FastqRecord`.
`static SAMRecord`
`asSAMRecord(FastqRecord record, SAMFileHeader header)`
Converts a `FastqRecord` into a simple unmapped `SAMRecord`.
`static SAMRecord`
`asSAMRecord(FastqRecord record, SAMFileHeader header, BiConsumer<FastqRecord, SAMRecord> custom)`
Converts a `FastqRecord` into a simple unmapped `SAMRecord`.
`static String`
`encode(FastqRecord record)`
Encodes a FastqRecord in the String FASTQ format.
`static String`
`encode(SAMRecord record)`
Encodes a SAMRecord in the String FASTQ format.
`static Appendable`
`write(Appendable out, FastqRecord record)`
Writes a FastqRecord into the Appendable output.

### Methods inherited from class Object

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

## Field Details

### QUALITY_HEADER_TO_COMMENT_TAG

public static final BiConsumer<FastqRecord, SAMRecord> QUALITY_HEADER_TO_COMMENT_TAG
Encodes the quality header into the comment tag (use in `asSAMRecord(FastqRecord, SAMFileHeader, BiConsumer)`.

Note that all tabs present in the quality header are replaced by spaces.

### QUALITY_HEADER_PARSE_SAM_TAGS

public static final BiConsumer<FastqRecord, SAMRecord> QUALITY_HEADER_PARSE_SAM_TAGS

## Method Details

### encode

public static String encode(FastqRecord record)
Encodes a FastqRecord in the String FASTQ format.

### write

public static Appendable write(Appendable out, FastqRecord record)
Writes a FastqRecord into the Appendable output.

Throws:
  `SAMException` - if any I/O error occurs.

### encode

public static String encode(SAMRecord record)
Encodes a SAMRecord in the String FASTQ format.

See Also:
  - `encode(FastqRecord)`
  - `asSAMRecord(FastqRecord, SAMFileHeader)`

### asFastqRecord

public static FastqRecord asFastqRecord(SAMRecord record)
Converts a `SAMRecord` into a `FastqRecord`.

### asSAMRecord

public static SAMRecord asSAMRecord(FastqRecord record, SAMFileHeader header)
Converts a `FastqRecord` into a simple unmapped `SAMRecord`.

### asSAMRecord

public static SAMRecord asSAMRecord(FastqRecord record, SAMFileHeader header, BiConsumer<FastqRecord, SAMRecord> custom)
Converts a `FastqRecord` into a simple unmapped `SAMRecord`.

This method allows to pass a `BiConsumer` to add the information from the record in a customizable manner.

Parameters:
  `record` - object to encode.
  `header` - header for the returned object.
  `custom` - function to customize encoding. Note that default information might be overriden.