Class Downloader<T>

java.lang.Object
uk.ac.starlink.topcat.activate.Downloader<T>

public class Downloader<T> extends Object
Manages download of data that may be required in multiple places.
Since:
24 Oct 2019
Author:
Mark Taylor
  • Constructor Details

    • Downloader

      public Downloader(String dataDescription, Callable<T> supplier)
      Constructor.
      Parameters:
      dataDescription - short description of downloaded data, may be used in logging messages
      supplier - supplier of downloaded data
  • Method Details

    • start

      public void start()
      Ensures that this downloader has started to downloading the data. If it has already started (and possibly finished), this has no effect.
    • getData

      public T getData()
      Immediately returns the downloaded data, or null if it has not been downloaded, or if a download has failed.
      Returns:
      downloaded result, or null
    • addActionListener

      public void addActionListener(ActionListener l)
      Adds a listener that will be notified when the data has become available.
      Parameters:
      l - listener
    • removeActionListener

      public void removeActionListener(ActionListener l)
      Removes a listener previously added.
      Parameters:
      l - listener