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 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
    • canResume

      @UiThread default boolean canResume()
      Returns:
      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.
    • error

      @Nullable @UiThread default Integer error()
      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.
    • fileExists

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

      @NonNull @UiThread default String 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.
    • mime

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

      @UiThread default boolean paused()
      Returns:
      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:
      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
    • 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
    • totalBytes

      @UiThread default long totalBytes()
      Returns:
      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