Class RecordParser<T>

  • All Implemented Interfaces:
    Parser<T>
    Direct Known Subclasses:
    FastaParser, SwissProtParser

    public abstract class RecordParser<T>
    extends Object
    implements Parser<T>
    Abstract record-based parser. Records are defined by lines starting with a given record separator. The default record separator is ">".
    Author:
    pavlidis
    • Field Detail

      • log

        protected static final org.apache.commons.logging.Log log
    • Constructor Detail

      • RecordParser

        public RecordParser()
    • Method Detail

      • getResults

        public abstract Collection<T> getResults()
        Specified by:
        getResults in interface Parser<T>
        Returns:
        the results of the parse.
      • parse

        public void parse​(File file)
                   throws IOException
        Description copied from interface: Parser
        Parse a File
        Specified by:
        parse in interface Parser<T>
        Parameters:
        file - file
        Throws:
        IOException - if there is a problem while manipulating the file
      • parse

        public void parse​(String filename)
                   throws IOException
        Description copied from interface: Parser
        Parse a file identified by its path.
        Specified by:
        parse in interface Parser<T>
        Parameters:
        filename - Absolute path to the file
        Throws:
        IOException - if there is a problem while manipulating the file
      • setRecordSeparator

        public void setRecordSeparator​(String recordSeparator)
      • parseOneRecord

        protected abstract Object parseOneRecord​(String record)
        Handle the parsing of a single record from the input.
        Parameters:
        record - record
        Returns:
        parsed object
      • addResult

        protected abstract void addResult​(Object obj)
        Add an object to the results collection.
        Parameters:
        obj - object