# InstallerDownloadEvent

Import: `import com.install4j.api.events.InstallerDownloadEvent;`

```java
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`](../context/InstallerContext.md).

This event object contains additional information about the download.
The event types [`EventType.BEFORE_DOWNLOAD`](EventType.md#before-download) and [`EventType.AFTER_DOWNLOAD`](EventType.md#after-download)
produce this event object when fired.


**See also:**

- [InstallerEventListener](InstallerEventListener.md)
- [InstallerContext.addInstallerEventListener](../context/InstallerContext.md#addinstallereventlistener-installereventlistener)

| Type | Kind | Description |
|---|---|---|
## Nested types

| [InstallerDownloadEvent.DownloadProgressListener](InstallerDownloadEvent.DownloadProgressListener.md) | interface | A listener that is informed about the progress of a download. |

## Inherited from

- [InstallerEvent](InstallerEvent.md) — 6 methods

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getUrl()`](#geturl) | `URL` | Returns the URL of the download. |
| [`getDownloadFile()`](#getdownloadfile) | `File` | Returns the file where the download is saved. |
| [`getDownloadSize()`](#getdownloadsize) | `long` | Returns the size for the download in bytes. |
| [`addDownloadProgressListener(DownloadProgressListener)`](#adddownloadprogresslistener-downloadprogresslistener) | `void` | Add a progress listener that is informed how the progress download is progressing. |
| [`getDownloadProgressListeners()`](#getdownloadprogresslisteners) | `Set<DownloadProgressListener>` | Get the complete set of download progress listeners. |
| [`toString()`](#tostring) | `String` |  |
| [`getVerbose()`](#getverbose) | `String` |  |

### getUrl()

```java
public URL getUrl()
```

Returns the URL of the download.


**Returns:** the URL

### getDownloadFile()

```java
public File getDownloadFile()
```

Returns the file where the download is saved.


**Returns:** the download file

### getDownloadSize()

```java
public long getDownloadSize()
```

Returns the size for the download in bytes.


**Returns:** the size

### addDownloadProgressListener(DownloadProgressListener)

```java
public void addDownloadProgressListener(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`](EventType.md#before-download).


**Parameters:**

- `listener` — the progress listener

### getDownloadProgressListeners()

```java
public Set<DownloadProgressListener> getDownloadProgressListeners()
```

Get the complete set of download progress listeners.


**Returns:** the set

### toString()

```java
public String toString()
```

### getVerbose()

```java
public String getVerbose()
```

## Constructors

| Signature | Description |
|---|---|
| [`InstallerDownloadEvent(Object, Context, EventType, boolean, URL, File, long)`](#installerdownloadevent-object-context-eventtype-boolean-url-file-long) | The constructor is called by the framework. |
| [`InstallerDownloadEvent(Object, Context, EventType, URL, File, long)`](#installerdownloadevent-object-context-eventtype-url-file-long) | The constructor is called by the framework. |

### InstallerDownloadEvent(Object, Context, EventType, boolean, URL, File, long)

```java
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(Object, Context, EventType, URL, File, long)

```java
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

