public class Filedownload extends Object
Fileupload
Constructor and Description |
---|
Filedownload() |
Modifier and Type | Method and Description |
---|---|
static void |
save(byte[] content,
String contentType,
String flnm)
Open a download dialog to save the specified content at the client
with the suggested file name.
|
static void |
save(File file,
String contentType)
Open a download dialog to save the specified file at the client.
|
static void |
save(InputStream content,
String contentType,
String flnm)
Open a download dialog to save the specified content at the client
with the suggested file name.
Note: You don't need to close the content (a InputStream), it will be closed automatically after download. |
static void |
save(org.zkoss.util.media.Media media)
Open a download dialog to save the specified content at the client.
|
static void |
save(org.zkoss.util.media.Media media,
String flnm)
Open a download dialog to save the specified content at the client
with the suggested file name.
|
static void |
save(Reader content,
String contentType,
String flnm)
Open a download dialog to save the specified content at the client
with the suggested file name.
Note: You don't need to close the content (a Reader), it will be closed automatically after download. |
static void |
save(String path,
String contentType)
Open a download dialog to save the resource of the specified path
at the client.
|
static void |
save(String content,
String contentType,
String flnm)
Open a download dialog to save the specified content at the client
with the suggested file name.
|
static void |
save(URL url,
String contentType)
Open a download dialog to save the resource of the specified URL
at the client.
|
public static void save(org.zkoss.util.media.Media media)
public static void save(org.zkoss.util.media.Media media, String flnm)
media
- the media to downloadflnm
- the suggested file name, e.g., myfile.pdf.
If null, Media.getName()
is assumed.public static void save(byte[] content, String contentType, String flnm)
content
- the contentcontentType
- the content type (a.k.a., MIME type),
e.g., application/pdfflnm
- 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)
content
- the contentcontentType
- the content type (a.k.a., MIME type),
e.g., application/pdfflnm
- 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)
content
- the contentcontentType
- the content type (a.k.a., MIME type),
e.g., application/pdfflnm
- 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)
content
- the contentcontentType
- the content type (a.k.a., MIME type),
e.g., application/pdfflnm
- the suggested file name, e.g., myfile.pdf.
If null, no suggested name is provided.public static void save(File file, String contentType) throws FileNotFoundException
file
- the file to download to the clientcontentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the file name's
extension is used to determine the content type.FileNotFoundException
- if the file is not found.public static void save(URL url, String contentType) throws FileNotFoundException
WebApp.getResource(java.lang.String)
.url
- the URL to get the resourcecontentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the path's
extension is used to determine the content type.FileNotFoundException
- if the resource is not found.public static void save(String path, String contentType) throws FileNotFoundException
path
- the path of the resource.
It must be retrievable by use of WebApp.getResource(java.lang.String)
.contentType
- the content type, e.g., application/pdf.
Unlike other save methods, it is optional. If null, the path's
extension is used to determine the content type.FileNotFoundException
- if the resource is not found.Copyright © 2019. All rights reserved.