| | |
| | | } |
| | | InputStream inputStream = HttpsUtil.connectionInputsteam(param.getUrl(),"GET","",null); |
| | | if(inputStream == null){ |
| | | if(StringUtils.isBlank(param.getUrl())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"文件下载失败,请检查文件路径是否合法!"); |
| | | } |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"文件下载失败,请检查文件路径是否合法!"); |
| | | } |
| | | if(StringUtils.isBlank(param.getFileName())){ |
| | | param.setFileName(System.currentTimeMillis()+""); |
| | |
| | | ServletOutputStream os = response.getOutputStream(); |
| | | byte[] buffer = new byte[4096]; |
| | | int bytesRead; |
| | | |
| | | while ((bytesRead = inputStream.read(buffer)) != -1) { |
| | | os.write(buffer, 0, bytesRead); |
| | | } |