public String getAntConfigDataPath() {
String fileName = "testdata.txt";
String fontPath = System.getProperty("user.dir") + File.separator + fileName;
try {
File fontFile = new File(fontPath);
if (fontFile.exists()) {
return fontPath;
}
//该位置没则从fatjar中取
InputStream inputStream = ImportDataByAnt.class.getClassLoader().getResourceAsStream(fileName);
if (inputStream == null) {
log.warn("getAntConfigDataPath exception: not have font file " + fileName);
return null;
}
OutputStream outputStream = new FileOutputStream(fontFile);
IOUtils.copy(inputStream, outputStream);
log.info(fileName + " get from fatjar, getAntConfigDataPath");
} catch (Exception e) {
log.error("getAntConfigDataPath exception ", e);
}
return fontPath;
}