JXL性能问题讨论
下面这个方面可能产生大内存吗?如果EXCEL有2000~5000行数据的话?
public List getExcelList(InputStream inputStream,List errorMsgList,List warningMsgList,String roleType) throws Exception { List excelList = new ArrayList(); jxl.Workbook rwb = Workbook.getWorkbook(inputStream); Sheet rs = rwb.getSheet(0); int rows = rs.getRows(); Cell cell = null; InvoiceModifyEntity entity = null; String strs[] = MyUtil.getAttributeHeadInfoToEntity(rs); for (int j = 2; j < rows; j++){ cell = rs.getCell(0, j); if(cell.getContents() !=null && cell.getContents().length()>0){ //跳过处理 if(this.isSkipRow(rs,j)) continue; entity = new InvoiceModifyEntity(); entity.setAttr_inds(strs[0]); entity.setAttr_codes(strs[1]); describeModifyHeader(entity,j,rs,errorMsgList,warningMsgList); MyUtil.setAttributeValueByEnity(entity, rs, j,errorMsgList,warningMsgList,roleType); MyUtil.validateInvoiceCurrencyAndAmt(entity, j, errorMsgList, warningMsgList,36); excelList.add(entity); //超过最大错误数量,则不再处理 if(isOverErrorCount(errorMsgList)) break; } } return excelList; }