解决POI读取Excel内存溢出的问题

解决POI读取超大Excel内存溢出的问题

为了解决poi读取超大文件的问题,以下是代码及github地址:

GITHUB:
https://github.com/white55/csvReader/blob/master/src/BigExcelReaderPoi.java

/**
* Created by 张超 on 2017/9/7.
*/
public class BigExcelReaderPoi {
OutputStream os;
OutputStreamWriter osw;
BufferedWriter bw;
WorkbookSettings ws=new WorkbookSettings();
jxl.Workbook wk;
FileInputStream in;
public BigExcelReaderPoi() throws FileNotFoundException {
}
public void xlsConvertToCsv(String inputPath,String outputPath){
try {
os=new FileOutputStream(new File(outputPath));
osw=new OutputStreamWriter(os,”UTF8”);
bw=new BufferedWriter(osw);
//载入excel文件
ws.setLocale(new Locale(“en”,”EN”));
wk= jxl.Workbook.getWorkbook(new File(inputPath),ws);
//从工作簿workbook取得每页sheets
for(int sheet=0;sheet

你可能感兴趣的:(日常报错)