comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/LineParser.java @ 5809:53fcc0d5a03e

LineParser: Store reference to input file.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 24 Apr 2013 12:04:25 +0200
parents b0b1008c07e9
children
comparison
equal deleted inserted replaced
5808:c69ce591e3ea 5809:53fcc0d5a03e
43 protected abstract void finish(); 43 protected abstract void finish();
44 44
45 /** Name of file parsed. */ 45 /** Name of file parsed. */
46 protected String fileName; 46 protected String fileName;
47 47
48 protected File inputFile;
49
48 50
49 /** 51 /**
50 * This method reads each line of <i>file</i>. At the beginning, 52 * This method reads each line of <i>file</i>. At the beginning,
51 * <i>reset()</i> is called; afterwards for each line <i>handleLine()</i> is 53 * <i>reset()</i> is called; afterwards for each line <i>handleLine()</i> is
52 * called; at the end <i>finish</i> is called. 54 * called; at the end <i>finish</i> is called.
53 * 55 *
54 * @param file The file which should be parsed. 56 * @param file The file which should be parsed.
55 */ 57 */
56 public void parse(File file) throws IOException { 58 public void parse(File file) throws IOException {
57 log.info("Parsing file '" + file + "'"); 59 log.info("Parsing file '" + file + "'");
60
61 inputFile = file;
58 62
59 fileName = file.getName(); 63 fileName = file.getName();
60 64
61 reset(); 65 reset();
62 66
91 /** Returns the name of the file parsed. */ 95 /** Returns the name of the file parsed. */
92 protected String getFileName() { 96 protected String getFileName() {
93 return fileName; 97 return fileName;
94 } 98 }
95 99
100 /** Returns the file currently parsed. */
101 protected File getInputFile() {
102 return inputFile;
103 }
104
96 105
97 protected static String stripMetaLine(String line) { 106 protected static String stripMetaLine(String line) {
98 String tmp = line.substring(1, line.length()); 107 String tmp = line.substring(1, line.length());
99 108
100 if (tmp.startsWith(" ")) { 109 if (tmp.startsWith(" ")) {

http://dive4elements.wald.intevation.org