filedownload.java

来自「ZK 基础介绍 功能操作 模块 结合数据库操作」· Java 代码 · 共 96 行

JAVA
96
字号
/* Filedownload.java{{IS_NOTE	Purpose:			Description:			History:		Mon Apr 16 14:41:22     2007, Created by tomyeh}}IS_NOTECopyright (C) 2007 Potix Corporation. All Rights Reserved.{{IS_RIGHT	This program is distributed under GPL Version 2.0 in the hope that	it will be useful, but WITHOUT ANY WARRANTY.}}IS_RIGHT*/package org.zkoss.zhtml;import java.io.InputStream;import java.io.Reader;import org.zkoss.util.media.Media;/** * File download utilities. *  * @author tomyeh */public class Filedownload {	/** Open a download dialog to save the specified content at the client.	 */	public static void save(Media media) {		org.zkoss.zul.Filedownload.save(media);	}	/** Open a download dialog to save the specified content at the client	 * with the suggested file name.	 *	 * @param media the media to download	 * @param flnm the suggested file name, e.g., myfile.pdf.	 * If null, {@link Media#getName} is assumed.	 */	public static void save(Media media, String flnm) {		org.zkoss.zul.Filedownload.save(media, flnm);	}	/** Open a download dialog to save the specified content at the client	 * with the suggested file name.	 *	 * @param content the content	 * @param contentType the content type (aka., mine type),	 * e.g., application/pdf	 * @param flnm the suggested file name, e.g., myfile.pdf.	 * If null, no suggested name is provided.	 */	public static void save(byte[] content, String contentType, String flnm) {		org.zkoss.zul.Filedownload.save(content, contentType, flnm);	}	/** Open a download dialog to save the specified content at the client	 * with the suggested file name.	 *	 * @param content the content	 * @param contentType the content type (aka., mine type),	 * e.g., application/pdf	 * @param flnm the suggested file name, e.g., myfile.pdf.	 * If null, no suggested name is provided.	 */	public static void save(String content, String contentType, String flnm) {		org.zkoss.zul.Filedownload.save(content, contentType, flnm);	}	/** Open a download dialog to save the specified content at the client	 * with the suggested file name.	 *	 * @param content the content	 * @param contentType the content type (aka., mine type),	 * e.g., application/pdf	 * @param flnm the suggested file name, e.g., myfile.pdf.	 * If null, no suggested name is provided.	 */	public static void save(InputStream content, String contentType, String flnm) {		org.zkoss.zul.Filedownload.save(content, contentType, flnm);	}	/** Open a download dialog to save the specified content at the client	 * with the suggested file name.	 *	 * @param content the content	 * @param contentType the content type (aka., mine type),	 * e.g., application/pdf	 * @param flnm the suggested file name, e.g., myfile.pdf.	 * If null, no suggested name is provided.	 */	public static void save(Reader content, String contentType, String flnm) {		org.zkoss.zul.Filedownload.save(content, contentType, flnm);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?