use of java.io.FileReader in project Truck-Factor by aserg-ufmg.
the class Alias method readFile.
private static Alias[] readFile(String fileName) throws IOException {
List<Alias> fileAliases = new ArrayList<Alias>();
BufferedReader br = new BufferedReader(new FileReader(fileName));
LineReader lineReader = new LineReader(br);
String sCurrentLine;
String[] values;
int countcfs = 0;
while ((sCurrentLine = lineReader.readLine()) != null) {
values = sCurrentLine.split(";");
if (values.length < 3)
System.err.println("Erro na linha " + countcfs);
String rep = values[0];
String dev1 = values[1];
String dev2 = values[2];
fileAliases.add(new Alias(rep, dev1, dev2));
countcfs++;
}
return fileAliases.toArray(new Alias[0]);
}
use of java.io.FileReader in project Truck-Factor by aserg-ufmg.
the class FileInfoReader method getFileInfo.
public static Map<String, List<LineInfo>> getFileInfo(String fileName) throws IOException {
Map<String, List<LineInfo>> fileInfoMap = new HashMap<String, List<LineInfo>>();
BufferedReader br = new BufferedReader(new FileReader(fileName));
LineReader lineReader = new LineReader(br);
String sCurrentLine;
String[] values;
int countcfs = 0;
while ((sCurrentLine = lineReader.readLine()) != null) {
if (sCurrentLine.startsWith("#"))
continue;
values = sCurrentLine.split(";");
if (values.length < 3)
System.err.println("Erro na linha " + countcfs);
String rep = values[0];
if (!fileInfoMap.containsKey(rep)) {
fileInfoMap.put(rep, new ArrayList<LineInfo>());
}
fileInfoMap.get(rep).add(new LineInfo(rep, Arrays.asList(values).subList(1, values.length)));
}
//lineReader.close();
return fileInfoMap;
}
use of java.io.FileReader in project Truck-Factor by aserg-ufmg.
the class FileInfoExtractor method execute.
public List<NewFileInfo> execute() throws Exception {
List<NewFileInfo> files = new ArrayList<NewFileInfo>();
try {
LOGGER.info(repositoryName + ": Extracting file information...");
BufferedReader br = new BufferedReader(new FileReader(repositoryPath + fileName));
String sCurrentLine;
while ((sCurrentLine = br.readLine()) != null) {
files.add(new NewFileInfo(repositoryName, sCurrentLine));
}
br.close();
} catch (Exception e) {
throw new Exception("Error in project " + repositoryName, e);
}
return files;
}
use of java.io.FileReader in project Truck-Factor by aserg-ufmg.
the class GitLogExtractor method insertFiles.
private void insertFiles(String projectName, Map<String, LogCommitInfo> mapCommit) throws IOException {
LOGGER.info(projectName + ": Extracting logCommitFiles...");
BufferedReader br = new BufferedReader(new FileReader(repositoryPath + "commitfileinfo.log"));
String sCurrentLine;
String[] values;
while ((sCurrentLine = br.readLine()) != null) {
values = sCurrentLine.split(";");
String sha = values[0];
LogCommitInfo commit = mapCommit.get(sha);
commit.addCommitFile(new LogCommitFileInfo(commit, values[1], values[2], values[3]));
}
br.close();
}
use of java.io.FileReader in project h2o-3 by h2oai.
the class H2OBuildVersion method calcBuildNumber.
private String calcBuildNumber(File rootDir, String versionFromGradle) {
try {
String buildNumberFileName = rootDir.toString() + File.separator + "gradle" + File.separator + "buildnumber.properties";
File f = new File(buildNumberFileName);
if (!f.exists()) {
return "99999";
}
BufferedReader br = new BufferedReader(new FileReader(buildNumberFileName));
String line = br.readLine();
while (line != null) {
Pattern p = Pattern.compile("BUILD_NUMBER\\s*=\\s*(\\S+)");
Matcher m = p.matcher(line);
boolean b = m.matches();
if (b) {
br.close();
String buildNumber = m.group(1);
return buildNumber;
}
line = br.readLine();
}
throw new RuntimeException("BUILD_NUMBER property not found in " + buildNumberFileName);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations