Package org.gnome.webkit
Class Download.Builder<B extends Download.Builder<B>>
java.lang.Object
io.github.jwharm.javagi.gobject.Builder<B>
org.gnome.gobject.GObject.Builder<B>
org.gnome.webkit.Download.Builder<B>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
Download
Inner class implementing a builder pattern to construct a GObject with
properties.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theDownload
object.This signal is emitted afterWebKitDownload
::decide-destination and beforeWebKitDownload
::received-data to notify that destination file has been created successfully atdestination
.This signal is emitted after response is received to decide a destination for the download using webkit_download_set_destination().onFailed
(Download.FailedCallback handler) This signal is emitted when an error occurs during the download operation.onFinished
(Download.FinishedCallback handler) This signal is emitted when download finishes successfully or due to an error.This signal is emitted after response is received, every time new data has been written to the destination.setAllowOverwrite
(boolean allowOverwrite) Whether or not the download is allowed to overwrite an existing file on disk.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theDownload
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toDownload
.- Overrides:
build
in classGObject.Builder<B extends Download.Builder<B>>
- Returns:
- a new instance of
Download
with the properties that were set in the Builder object. - Throws:
UnsupportedPlatformException
- when run on an unsupported platform
-
setAllowOverwrite
Whether or not the download is allowed to overwrite an existing file on disk. If this property isfalse
and the destination already exists, the download will fail.- Parameters:
allowOverwrite
- the value for theallow-overwrite
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onCreatedDestination
This signal is emitted afterWebKitDownload
::decide-destination and beforeWebKitDownload
::received-data to notify that destination file has been created successfully atdestination
.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDecideDestination
This signal is emitted after response is received to decide a destination for the download using webkit_download_set_destination(). If this signal is not handled, the file will be downloaded toUserDirectory.DIRECTORY_DOWNLOAD
directory usingsuggestedFilename
.Since 2.40, you may handle this signal asynchronously by returning
true
without calling webkit_download_set_destination(). This indicates intent to eventually call webkit_download_set_destination(). In this case, the download will not proceed until the destination is set or cancelled with webkit_download_cancel().- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onFailed
This signal is emitted when an error occurs during the download operation. The givenerror
, of the domainWEBKIT_DOWNLOAD_ERROR
, contains further details of the failure. If the download is cancelled with webkit_download_cancel(), this signal is emitted with errorDownloadError.CANCELLED_BY_USER
. The download operation finishes after an error andWebKitDownload
::finished signal is emitted after this one.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onFinished
This signal is emitted when download finishes successfully or due to an error. In case of errorsWebKitDownload
::failed signal is emitted before this one.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onReceivedData
This signal is emitted after response is received, every time new data has been written to the destination. It's useful to know the progress of the download operation.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-