Class TextFileParserImpl
- java.lang.Object
-
- cern.accsoft.steering.jmad.util.io.impl.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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXTENSION_BZIP2
static java.lang.String
EXTENSION_GZIP
static int
LENGTH_BZIP_MAGIC_BYTES
-
Constructor Summary
Constructors Constructor Description TextFileParserImpl()
-
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
-
-
-
Field Detail
-
EXTENSION_GZIP
public static final java.lang.String EXTENSION_GZIP
- See Also:
- Constant Field Values
-
EXTENSION_BZIP2
public static final java.lang.String EXTENSION_BZIP2
- See Also:
- Constant Field Values
-
LENGTH_BZIP_MAGIC_BYTES
public static final int LENGTH_BZIP_MAGIC_BYTES
- See Also:
- Constant Field Values
-
-
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 interfaceTextFileParser
- 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
-
-