Class AbstractFeatureCodec<FEATURE_TYPE extends Feature,​SOURCE>

  • All Implemented Interfaces:
    FeatureCodec<FEATURE_TYPE,​SOURCE>
    Direct Known Subclasses:
    AsciiFeatureCodec

    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 only one codec is allowed to identify itself as being able to decode any given file.
    • Constructor Detail

      • AbstractFeatureCodec

        protected AbstractFeatureCodec​(Class<FEATURE_TYPE> myClass)
    • Method Detail

      • 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.