使用poi时报错:java.io.EOFException: Unexpected end of ZLIB input stream
原文:
点击查看代码
File excelFile = new File(filePath);
try {
if (excelFile.exists()) {
wb = new SXSSFWorkbook(new XSSFWorkbook(excelFile), 1000,true);
} else {
wb = new SXSSFWorkbook(1000);
}
} catch (IOException e) {
logger.error(trackId + e.getMessage(), e);
}
excelFile改为new FileInputStream(filePath) 即解决报错
点击查看代码
File excelFile = new File(filePath);
try {
if (excelFile.exists()) {
wb = new SXSSFWorkbook(new XSSFWorkbook(new FileInputStream(filePath)), 1000,true);
} else {
wb = new SXSSFWorkbook(1000);
}
} catch (IOException e) {
logger.error(trackId + e.getMessage(), e);
}