/
IssueParser.java
53 lines (48 loc) · 1.71 KB
/
IssueParser.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package edu.hm.hafner.analysis;
import java.io.File;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.util.function.Function;
/**
* Parses a file and returns the issues reported in this file.
*
* @author Ullrich Hafner
*/
public abstract class IssueParser implements Serializable {
private static final long serialVersionUID = 200992696185460268L;
/**
* Parses the specified file for issues.
*
* @param file
* the file to parse
* @param charset
* the encoding to use when reading files
* @param preProcessor
* pre processes each input line before handing it to the actual parser
*
* @return the issues
* @throws ParsingException
* Signals that during parsing a non recoverable error has been occurred
* @throws ParsingCanceledException
* Signals that the parsing has been aborted by the user
*/
public abstract Report parse(File file, Charset charset, Function<String, String> preProcessor)
throws ParsingException, ParsingCanceledException;
/**
* Parses the specified file for issues.
*
* @param file
* the file to parse
* @param charset
* the encoding to use when reading files
*
* @return the issues
* @throws ParsingException
* Signals that during parsing a non recoverable error has been occurred
* @throws ParsingCanceledException
* Signals that the parsing has been aborted by the user
*/
public Report parse(final File file, final Charset charset) throws ParsingException, ParsingCanceledException {
return parse(file, charset, Function.identity());
}
}