# Class AbstractFeatureCodec<FEATURE_TYPE extends Feature, SOURCE>

java.lang.Object
htsjdk.tribble.AbstractFeatureCodec<FEATURE_TYPE, SOURCE>

All Implemented Interfaces:
  `FeatureCodec<FEATURE_TYPE, SOURCE>`

Direct Known Subclasses:
  `AsciiFeatureCodec, Gff3Codec`

public abstract class AbstractFeatureCodec<FEATURE_TYPE extends Feature, SOURCE> extends Object implements FeatureCodec<FEATURE_TYPE, SOURCE>
Simple basic class providing much of the basic functionality of codecs Every concrete subclass must implement `FeatureCodec.canDecode(String)` to indicate whether it can decode the file. Note that that method is the only way that the right codec for a file is identified and that <bold>only one</bold> codec is allowed to identify itself as being able to decode any given file.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`AbstractFeatureCodec(Class<FEATURE_TYPE> myClass)`

## Method Summary

Modifier and Type
Method
Description
`Feature`
`decodeLoc(SOURCE source)`
Decode a line to obtain just its FeatureLoc for indexing -- contig, start, and stop.
`Class<FEATURE_TYPE>`
`getFeatureType()`
This function returns the object the codec generates.

### Methods inherited from class Object

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

### Methods inherited from interface FeatureCodec

`canDecode, close, decode, getPathToDataFile, getTabixFormat, isDone, makeIndexableSourceFromStream, makeSourceFromStream, readHeader`

## Constructor Details

### AbstractFeatureCodec

protected AbstractFeatureCodec(Class<FEATURE_TYPE> myClass)

## Method Details

### decodeLoc

public Feature decodeLoc(SOURCE source) throws IOException
Description copied from interface: `FeatureCodec`
Decode a line to obtain just its FeatureLoc for indexing -- contig, start, and stop.

Specified by:
  `decodeLoc` in interface `FeatureCodec<FEATURE_TYPE extends Feature, SOURCE>`
Parameters:
  `source` - the input stream from which to decode the next record
Returns:
  Return the FeatureLoc encoded by the line, or null if the line does not represent a feature (e.g. is a comment)
Throws:
  `IOException`

### getFeatureType

public Class<FEATURE_TYPE> getFeatureType()
Description copied from interface: `FeatureCodec`

This function returns the object the codec generates. This is allowed to be Feature in the case where conditionally different types are generated. Be as specific as you can though.

This function is used by reflections based tools, so we can know the underlying type

Specified by:
  `getFeatureType` in interface `FeatureCodec<FEATURE_TYPE extends Feature, SOURCE>`
Returns:
  the feature type this codec generates.