zoukankan      html  css  js  c++  java
  • POI导出数据相关的辅助类

    package zxc.model.support;
    
    import java.io.ByteArrayInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    import java.util.List;
    
    @SuppressWarnings("unchecked")
    public class IeudBean {
    	//==============================文件下载属性================================
    	private String	contentType			= "text/plain";
    
    	private String	contentLength		= null;
    
    	private String	inputName			= "targetStream";
    
    	private String	contentDisposition	= "inline";
    
    	private int		bufferSize			= 4096;
    
    	//==============================文件上传属性================================
    	private File	upload;
    
    	private String	uploadContentType;
    
    	private String	uploadFilePath;
    
    	private String	uploadFileName;
    
    	private String	uploadExtension;
    
    	public String getContentType() {
    		return contentType;
    	}
    
    	public void setContentType(String contentType) {
    		this.contentType = contentType;
    	}
    
    	public String getContentLength() {
    		return contentLength;
    	}
    
    	public void setContentLength(String contentLength) {
    		this.contentLength = contentLength;
    	}
    
    	public String getInputName() {
    		return inputName;
    	}
    
    	public void setInputName(String inputName) {
    		this.inputName = inputName;
    	}
    
    	public String getContentDisposition() {
    		return contentDisposition.indexOf("filename") < 0 ? "filename=\"" + contentDisposition + "\"" : contentDisposition;
    	}
    
    	public void setContentDisposition(String contentDisposition) {
    		this.contentDisposition = contentDisposition;
    	}
    
    	public int getBufferSize() {
    		return bufferSize;
    	}
    
    	public void setBufferSize(int bufferSize) {
    		this.bufferSize = bufferSize;
    	}
    
    	public File getUpload() {
    		return upload;
    	}
    
    	public void setUpload(File upload) {
    		this.upload = upload;
    	}
    
    	public String getUploadContentType() {
    		return uploadContentType;
    	}
    
    	public void setUploadContentType(String uploadContentType) {
    		this.uploadContentType = uploadContentType;
    	}
    
    	public String getUploadFilePath() {
    		return uploadFilePath;
    	}
    
    	public void setUploadFilePath(String uploadFilePath) {
    		this.uploadFilePath = uploadFilePath;
    	}
    
    	public String getUploadFileName() {
    		return uploadFileName;
    	}
    
    	public void setUploadFileName(String uploadFileName) {
    		this.uploadFileName = uploadFileName;
    		if (uploadFileName != null && uploadFileName.lastIndexOf(".") > 0) {
    			this.uploadExtension = uploadFileName.substring(uploadFileName.lastIndexOf(".") + 1);
    		}
    	}
    
    	public String getUploadExtension() {
    		return uploadExtension;
    	}
    
    	public void setUploadExtension(String uploadExtension) {
    		this.uploadExtension = uploadExtension;
    	}
    
    	//==========================================辅助文件(流)====================================
    	private File		downLoadFile;
    
    	private InputStream	downLoadStream;
    
    	public File getDownLoadFile() {
    		return downLoadFile;
    	}
    
    	public void setDownLoadFile(File downLoadFile) {
    		this.downLoadFile = downLoadFile;
    	}
    
    	public InputStream getDownLoadStream() {
    		return downLoadStream;
    	}
    
    	public void setDownLoadStream(InputStream downLoadStream) {
    		this.downLoadStream = downLoadStream;
    	}
    
    	//======================================获取默认的下载文件流==========================
    	public InputStream getTargetStream() {
    		if (this.downLoadStream != null) {
    			return this.downLoadStream;
    		} else if (this.downLoadFile != null) {
    			try {
    				return new FileInputStream(this.downLoadFile);
    			} catch (FileNotFoundException e) {
    				System.err.println("指定的文件不存在");
    				return new ByteArrayInputStream(new byte[0]);
    			}
    		} else {
    			return new ByteArrayInputStream(new byte[0]);
    		}
    
    	}
    
    	//=====================================辅助文件下载===================================
    	private String						exportTPL;
    
    	//如果为true表示导出;如果为false表示导入;如果为null表示即不导入也不导出
    	private Boolean						export;
    
    	private String	region;
    
    	public String getExportTPL() {
    		return exportTPL;
    	}
    
    	public void setExportTPL(String exportTPL) {
    		this.exportTPL = exportTPL;
    	}
    
    	public Boolean getExport() {
    		return export;
    	}
    
    	public void setExport(Boolean export) {
    		this.export = export;
    	}
    	
    	public String getRegion() {
    		return region;
    	}
    
    	public void setRegion(String region) {
    		this.region = region;
    	}
    
    	@Override
    	public String toString() {
    		StringBuffer buffer = new StringBuffer(super.toString());
    		buffer.append("\n");
    		buffer.append("\tcontentType:" + contentType);
    		buffer.append("\tcontentLength:" + contentLength);
    		buffer.append("\tinputName:" + inputName);
    		buffer.append("\tdcontentDisposition:" + contentDisposition);
    		buffer.append("\n");
    		buffer.append("\tupload:" + upload);
    		buffer.append("\tuploadContentType:" + uploadContentType);
    		buffer.append("\tuploadFileName:" + uploadFileName);
    		buffer.append("\tuploadExtension:" + uploadExtension);
    		buffer.append("\n");
    		buffer.append("\tdownLoadFile:" + downLoadFile);
    		buffer.append("\tdownLoadStream:" + downLoadStream);
    		buffer.append("\texportTPL:" + exportTPL);
    		buffer.append("\texport:" + export);
    		buffer.append("\tregion:" + region);
    		buffer.append("\n");
    		//如果数据量太大则不便输出
    		if (exportData==null||(exportData instanceof List&& ((List<?>)exportData).size()<100)) {
    			buffer.append("\texportData:" + exportData);
    		}
    		buffer.append("\texportCompleted:" + exportCompleted);
    		buffer.append("\toneTimeExport:" + oneTimeExport);
    		return buffer.toString();
    	}
    
    	//需要导出数据的暂存地
    	private Object	exportData;
    
    	private boolean	exportCompleted;
    
    	private Boolean	oneTimeExport	= true;
    
    	private Integer	maxCountOneTime;
    	
    	//是否为列不定的情况
    	private Boolean dynamicCol = false;
    
    	public Object getExportData() {
    		return exportData;
    	}
    
    	public void setExportData(Object exportData) {
    		this.exportData = exportData;
    	}
    
    	public boolean getExportCompleted() {
    		return exportCompleted;
    	}
    
    	public void setExportCompleted(boolean exportCompleted) {
    		this.exportCompleted = exportCompleted;
    	}
    
    	public Boolean getOneTimeExport() {
    		return oneTimeExport;
    	}
    
    	public void setOneTimeExport(Boolean oneTimeExport) {
    		this.oneTimeExport = oneTimeExport;
    	}
    
    	public Integer getMaxCountOneTime() {
    		return maxCountOneTime;
    	}
    
    	public void setMaxCountOneTime(Integer maxCountOneTime) {
    		this.maxCountOneTime = maxCountOneTime;
    	}
    
    	public Boolean getDynamicCol() {
    		return dynamicCol;
    	}
    
    	public void setDynamicCol(Boolean dynamicCol) {
    		this.dynamicCol = dynamicCol;
    	}
    }
    
     
  • 相关阅读:
    Windows API 的数据类型与 Delphi 数据类型对照表
    Delphi 编译错误信息表
    Delphi中的容器类
    Delphi 快捷键
    代码折叠
    [转]Delphi中record的使用
    [转]常用公共函数单元
    Delphi 运行时错误信息表
    C#调用Win32 的API函数User32.dll
    [转]Delphi程序启动参数的读取
  • 原文地址:https://www.cnblogs.com/qq1988627/p/6606937.html
Copyright © 2011-2022 走看看