InstallerDownloadEvent (install4j API)
Description: declaration: package: com.install4j.api.events, class: InstallerDownloadEvent

# Class InstallerDownloadEvent

java.lang.Object
java.util.EventObject
com.install4j.api.events.InstallerEvent
com.install4j.api.events.InstallerDownloadEvent

All Implemented Interfaces:
  `Serializable`

public class InstallerDownloadEvent extends InstallerEvent
The event object that is passed to installer event listeners for download event types. Event listeners are registered in the `InstallerContext`.

This event object contains additional information about the download. The event types `EventType.BEFORE_DOWNLOAD` and `EventType.AFTER_DOWNLOAD` produce this event object when fired.

See Also:
  - `InstallerEventListener`
  - `Context.addInstallerEventListener(InstallerEventListener)`
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `InstallerDownloadEvent.DownloadProgressListener`
  A listener that is informed about the progress of a download.

- ## Field Summary

  ### Fields inherited from class EventObject

  `source`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `InstallerDownloadEvent(Object source, Context context, EventType type, boolean success, URL url, File downloadFile, long downloadSize)`
  The constructor is called by the framework.
  `InstallerDownloadEvent(Object source, Context context, EventType type, URL url, File downloadFile, long downloadSize)`
  The constructor is called by the framework.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addDownloadProgressListener(InstallerDownloadEvent.DownloadProgressListener listener)`
  Add a progress listener that is informed how the progress download is progressing.
  `File`
  `getDownloadFile()`
  Returns the file where the download is saved.
  `Set<InstallerDownloadEvent.DownloadProgressListener>`
  `getDownloadProgressListeners()`
  Get the complete set of download progress listeners.
  `long`
  `getDownloadSize()`
  Returns the size for the download in bytes.
  `URL`
  `getUrl()`
  Returns the URL of the download.
  `String`
  `getVerbose()`
  Return a verbose description of this event.
  `String`
  `toString()`

  ### Methods inherited from class InstallerEvent

  `getContext, getType, setContext, wasSuccessful`

  ### Methods inherited from class EventObject

  `getSource`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### InstallerDownloadEvent

    public InstallerDownloadEvent(Object source, Context context, EventType type, boolean success, URL url, File downloadFile, long downloadSize)
    The constructor is called by the framework.
    Parameters:
      `source` - the event source
      `context` - the context
      `type` - the event type.
      `success` - whether the operation associated with the event was successful
      `url` - the download URL
      `downloadFile` - the download file
      `downloadSize` - the size of the download

  - ### InstallerDownloadEvent

    public InstallerDownloadEvent(Object source, Context context, EventType type, URL url, File downloadFile, long downloadSize)
    The constructor is called by the framework.
    Parameters:
      `source` - the event source
      `context` - the context
      `type` - the event type.
      `url` - the download URL
      `downloadFile` - the download file
      `downloadSize` - the size of the download

- ## Method Details

  - ### getUrl

    public URL getUrl()
    Returns the URL of the download.
    Returns:
      the URL

  - ### getDownloadFile

    public File getDownloadFile()
    Returns the file where the download is saved.
    Returns:
      the download file

  - ### getDownloadSize

    public long getDownloadSize()
    Returns the size for the download in bytes.
    Returns:
      the size

  - ### addDownloadProgressListener

    public void addDownloadProgressListener(InstallerDownloadEvent.DownloadProgressListener listener)
    Add a progress listener that is informed how the progress download is progressing. This only makes sense to add if the event type is `EventType.BEFORE_DOWNLOAD`.
    Parameters:
      `listener` - the progress listener

  - ### getDownloadProgressListeners

    public Set<InstallerDownloadEvent.DownloadProgressListener> getDownloadProgressListeners()
    Get the complete set of download progress listeners.
    Returns:
      the set

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `InstallerEvent`

  - ### getVerbose

    public String getVerbose()
    Description copied from class: `InstallerEvent`
    Return a verbose description of this event.
    Overrides:
      `getVerbose` in class `InstallerEvent`
    Returns:
      the description