Class Filedownload

java.lang.Object
org.zkoss.zhtml.Filedownload

public class Filedownload extends Object
File download utilities.
Author:
tomyeh
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    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(InputStream 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(Reader 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(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(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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Filedownload

      public Filedownload()
  • Method Details

    • save

      public static void save(org.zkoss.util.media.Media media)
      Open a download dialog to save the specified content at the client.
    • save

      public 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.
      Parameters:
      media - the media to download
      flnm - the suggested file name, e.g., myfile.pdf. If null, Media.getName() is assumed.
    • save

      public 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.
      Parameters:
      content - the content
      contentType - the content type (a.k.a., MIME type), e.g., application/pdf
      flnm - the suggested file name, e.g., myfile.pdf. If null, no suggested name is provided.
    • save

      public 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.
      Parameters:
      content - the content
      contentType - the content type (a.k.a., MIME type), e.g., application/pdf
      flnm - the suggested file name, e.g., myfile.pdf. If null, no suggested name is provided.
    • save

      public 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.
      Parameters:
      content - the content
      contentType - the content type (a.k.a., MIME type), e.g., application/pdf
      flnm - the suggested file name, e.g., myfile.pdf. If null, no suggested name is provided.
    • save

      public 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.
      Parameters:
      content - the content
      contentType - the content type (a.k.a., MIME type), e.g., application/pdf
      flnm - the suggested file name, e.g., myfile.pdf. If null, no suggested name is provided.