Interface Downloader

All Known Implementing Classes:
DownloaderImpl

public interface Downloader
Generic interface to download data from the system.
  • Method Details

    • setFileStorage

      @Deprecated(since="2.3", forRemoval=true) void setFileStorage(FileStorage fileStorage)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Sets a file storage where the files will be downloaded from.
      Parameters:
      fileStorage - file storage
    • isShowNewWindow

      boolean isShowNewWindow()
      Returns:
      true if downloader should open a new window with the file content
    • setShowNewWindow

      void setShowNewWindow(boolean showNewWindow)
      Sets explicit new window option.
      Parameters:
      showNewWindow - true if downloader opens new window, otherwise false
    • setViewFilePredicate

      default void setViewFilePredicate(Predicate<String> viewFilePredicate)
      Sets a predicate that checks if file is allowed to be opened. It takes file extension as an input parameter and returns true if file is allowed to be opened or false if file should be downloaded.
      Parameters:
      viewFilePredicate - predicate
    • download

      void download(DownloadDataProvider dataProvider, String resourceName, @Nullable DownloadFormat format)
      Downloads an arbitrary resource defined by a DownloadDataProvider.
      Parameters:
      dataProvider - resource provider
      resourceName - resource name
      format - download format, can be null
    • download

      void download(DownloadDataProvider dataProvider, String resourceName)
      Downloads an arbitrary resource defined by a DownloadDataProvider.
      Parameters:
      dataProvider - resource provider
      resourceName - resource name
    • download

      void download(FileRef fileReference)
      Downloads a file from the FileStorage retrieved by FileStorageLocator using storage name from FileRef.
      Parameters:
      fileReference - file reference
    • download

      void download(FileRef fileReference, @Nullable DownloadFormat format)
      Downloads a file from the FileStorage retrieved by FileStorageLocator using storage name from FileRef.
      Parameters:
      fileReference - file reference
      format - download format, can be null
    • download

      void download(byte[] data, String resourceName)
      Downloads passed byte array.
      Parameters:
      data - data in the form of byte array
      resourceName - resource name
    • download

      void download(byte[] data, String resourceName, @Nullable DownloadFormat format)
      Downloads passed byte array.
      Parameters:
      data - data in the form of byte array
      resourceName - resource name
      format - download format, can be null