Class TextFileParserImpl

  • All Implemented Interfaces:
    TextFileParser

    public class TextFileParserImpl
    extends java.lang.Object
    implements TextFileParser
    Simple parser, that opens a TextFile and returns the (trimmed) lines as List.

    Additionaly, this parser can handle two different compression formats:

    • gzip
    • bzip2
    To handle the bzip2 compression bzip2.jar has to be in the classpath. Which compression to use is decided on the extension of the filename (".gz" for gzip and ".bz2" for bzip2).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> parse​(java.io.File file)
      parses the file and returns all the lines in an ArrayList
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextFileParserImpl

        public TextFileParserImpl()
    • Method Detail

      • parse

        public java.util.List<java.lang.String> parse​(java.io.File file)
                                               throws TextFileParserException
        Description copied from interface: TextFileParser
        parses the file and returns all the lines in an ArrayList
        Specified by:
        parse in interface TextFileParser
        Parameters:
        file - the file to parse
        Returns:
        a list containing strings which represent the lines in the file.
        Throws:
        TextFileParserException - if the parsing is not possible