@Test public void testWriteExcelByInputStream() { HttpServletResponseExcelWrite.build(this.getClass().getResourceAsStream("/c.xls"), fileName, request, response) .deal(new WriteDeal<ExcelDto>() { public String[] dealBean(ExcelDto obj) { String[] result = new String[3]; result[0] = obj.getId() + ""; result[1] = obj.getName(); result[2] = obj.getAge() + ""; return result; } public int skipLine() { return 4; } @Override public Map<String, Object> additional() { Map<String, Object> map = new HashMap<>(); map.put("quoteCurrency", "ETH"); map.put("symbol", "USDT_ETH"); map.put("startTime", "2019-01-09 00:00:00"); map.put("endTime", "2019-01-09 12:00:00"); return map; } }, ExcelDataList.getTenList()) .write(); }
public static ExcelWrite build(InputStream inputStream, String fileName, HttpServletRequest request, HttpServletResponse response) { Objects.requireNonNull(inputStream); Objects.requireNonNull(fileName); Objects.requireNonNull(request); Objects.requireNonNull(response); return new CopyInputStreamExcelWrite(inputStream, fileName, new HttpServletResponseExcelWrite(request, response)); }
HttpServletResponseExcelWrite implements OutputStreamDelegate { public static ExcelWrite build(InputStream inputStream, String fileName, HttpServletRequest request, HttpServletResponse response) { Objects.requireNonNull(inputStream); Objects.requireNonNull(fileName); Objects.requireNonNull(request); Objects.requireNonNull(response); return new CopyInputStreamExcelWrite(inputStream, fileName, new HttpServletResponseExcelWrite(request, response)); } }
HttpServletResponseExcelWrite implements OutputStreamDelegate { public static ExcelWrite build(InputStream inputStream, String fileName, HttpServletRequest request, HttpServletResponse response) { Objects.requireNonNull(inputStream); Objects.requireNonNull(fileName); Objects.requireNonNull(request); Objects.requireNonNull(response); return new CopyInputStreamExcelWrite(inputStream, fileName, new HttpServletResponseExcelWrite(request, response)); } private  HttpServletResponseExcelWrite(HttpServletRequest request, HttpServletResponse response); }
HttpServletResponseExcelWrite implements OutputStreamDelegate { public static ExcelWrite build(InputStream inputStream, String fileName, HttpServletRequest request, HttpServletResponse response) { Objects.requireNonNull(inputStream); Objects.requireNonNull(fileName); Objects.requireNonNull(request); Objects.requireNonNull(response); return new CopyInputStreamExcelWrite(inputStream, fileName, new HttpServletResponseExcelWrite(request, response)); } private  HttpServletResponseExcelWrite(HttpServletRequest request, HttpServletResponse response); @Override OutputStream createOutputStream(String fileName); static ExcelWrite build(InputStream inputStream, String fileName,
			HttpServletRequest request, HttpServletResponse response); static ExcelWrite build(String fileName, HttpServletRequest request, HttpServletResponse response); }
HttpServletResponseExcelWrite implements OutputStreamDelegate { public static ExcelWrite build(InputStream inputStream, String fileName, HttpServletRequest request, HttpServletResponse response) { Objects.requireNonNull(inputStream); Objects.requireNonNull(fileName); Objects.requireNonNull(request); Objects.requireNonNull(response); return new CopyInputStreamExcelWrite(inputStream, fileName, new HttpServletResponseExcelWrite(request, response)); } private  HttpServletResponseExcelWrite(HttpServletRequest request, HttpServletResponse response); @Override OutputStream createOutputStream(String fileName); static ExcelWrite build(InputStream inputStream, String fileName,
			HttpServletRequest request, HttpServletResponse response); static ExcelWrite build(String fileName, HttpServletRequest request, HttpServletResponse response);  }