in shardingsphere-benchmark/src/main/java/org/apache/shardingsphere/benchmark/common/file/excel/BenchmarkExcelWriter.java [57:91]
public static void writeExcel(String excelPath, String sheetName, boolean isHeader, int rowNum, List<BenchmarkResultBean> dataList){
Workbook workbook = null;
File exportFile = null;
FileOutputStream fileOut = null;
if (dataList.size() > 0) {
try {
exportFile = new File(excelPath);
if(exportFile.exists()){
workbook = new HSSFWorkbook(new FileInputStream(excelPath));
} else {
workbook = new HSSFWorkbook();
exportFile.createNewFile();
}
workbook = buildDataSheet(workbook, sheetName, isHeader, rowNum, dataList);
fileOut = new FileOutputStream(excelPath);
workbook.write(fileOut);
fileOut.flush();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
if (fileOut != null) {
fileOut.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}