Interface WebExtension.Download.Info

Enclosing class:
WebExtension.Download

public static interface WebExtension.Download.Info
Interface for communicating the state of downloads to Web Extensions. See also WebExtensions/API/downloads/DownloadItem
  • Method Summary

    Modifier and Type
    Method
    Description
    default long
    Returns a number representing the number of bytes received so far from the host during the download.
    default boolean
    Returns a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted.
    default Long
    Returns a number representing the time when this download ended.
    default Integer
    Returns one of Interrupt Reason constants denoting the error reason.
    default Long
    Returns the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed.
    default boolean
    Returns a boolean indicating whether a downloaded file still exists.
    default String
    Returns the filename.
    default long
    Returns the total number of bytes in the whole file, after decompression.
    default String
    Returns the downloaded file's MIME type.
    default boolean
    Returns a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open.
    default String
    Returns a string representing the downloaded file's referrer.
    default long
    Returns the number of milliseconds between the UNIX epoch and when this download began.
    default int
    Returns a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete.
    default long
    Returns the total number of bytes in the file being downloaded.
  • Method Details

    • bytesReceived

      @UiThread default long bytesReceived()
      Returns a number representing the number of bytes received so far from the host during the download. This does not take file compression into consideration.
      Returns:
      a number representing the number of bytes received so far from the host during the download
    • canResume

      @UiThread default boolean canResume()
      Returns a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted.
      Returns:
      a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted
    • endTime

      @Nullable @UiThread default Long endTime()
      Returns a number representing the time when this download ended. This is null if the download has not yet finished.
      Returns:
      a number representing the time when this download ended
    • error

      @Nullable @UiThread default Integer error()
      Returns one of Interrupt Reason constants denoting the error reason.
      Returns:
      one of Interrupt Reason constants denoting the error reason
    • estimatedEndTime

      @Nullable @UiThread default Long estimatedEndTime()
      Returns the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed. This is null if it is not known.
      Returns:
      the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed
    • fileExists

      @UiThread default boolean fileExists()
      Returns a boolean indicating whether a downloaded file still exists.
      Returns:
      a boolean indicating whether a downloaded file still exists
    • filename

      @NonNull @UiThread default String filename()
      Returns the filename.
      Returns:
      the filename
    • fileSize

      @UiThread default long fileSize()
      Returns the total number of bytes in the whole file, after decompression. A value of -1 means that the total file size is unknown.
      Returns:
      the total number of bytes in the whole file, after decompression
    • mime

      @NonNull @UiThread default String mime()
      Returns the downloaded file's MIME type.
      Returns:
      the downloaded file's MIME type
    • paused

      @UiThread default boolean paused()
      Returns a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open.
      Returns:
      a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open
    • referrer

      @NonNull @UiThread default String referrer()
      Returns a string representing the downloaded file's referrer.
      Returns:
      a string representing the downloaded file's referrer
    • startTime

      @UiThread default long startTime()
      Returns the number of milliseconds between the UNIX epoch and when this download began.
      Returns:
      the number of milliseconds between the UNIX epoch and when this download began
    • state

      @UiThread default int state()
      Returns a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete.
      Returns:
      a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete
    • totalBytes

      @UiThread default long totalBytes()
      Returns the total number of bytes in the file being downloaded. This does not take file compression into consideration. A value of -1 here means that the total number of bytes is unknown.
      Returns:
      the total number of bytes in the file being downloaded