Class DLDownloadManager

java.lang.Object
rawDeepLearningClassifier.DLDownloadManager

public class DLDownloadManager extends Object
Manages the downloading and unzipping of models.
  • Field Details

    • defaultModels

      public static String[] defaultModels
  • Constructor Details

    • DLDownloadManager

      public DLDownloadManager()
  • Method Details

    • isModelDownloaded

      public boolean isModelDownloaded(URL modelURL)
      Check whether has been downloaded already to a default local folder?
      Parameters:
      modelURI - - the URL of the model
      Returns:
    • isModelDownloaded

      public boolean isModelDownloaded(URL modelURL, String modelName)
      Check whether has been downloaded already?
      Parameters:
      modelName - - the model name that has been used to name the temporary folder.
      modelURI - - the URL of the model
      Returns:
      true if the model has been downloaded.
    • getModelDownloadedFile

      public File getModelDownloadedFile(URL modelURL, String modelName)
      Get the path to the model if it has been downloaded.
      Parameters:
      modelURL - - the URL to the model
      modelName - - the model name. Use getModelName(modelURL) to use the default model name.
      Returns:
      a file object - may not exist.
    • downloadModel

      public URI downloadModel(URI modelURI)
      Get the path to a model. If the URI is a URL then the model is download to a local folder and the path to the local folder is returned.
      Parameters:
      model - - the model to load.
      modelName - - the name of the model - this is used to create the local folder name if the model is downloaded.
      Returns:
      the path to the model The model might be a zip file, py file, koogu file.
    • downloadModel

      public URI downloadModel(URI modelURI, String modelName)
      Get the path to a model. If the URI is a URL then the model is download to a local folder and the path to the local folder is returned.
      Parameters:
      modelName - - the name of the model - this is used to create the local folder name if the model is downloaded.
      model - - the model to load.
      Returns:
      the path to the model The model might be a zip file, py file, .kgu file.
    • getModelFolder

      public static String getModelFolder()
      Get the model folder - create it if it doesn't exist.
      Returns:
      file object for new folder
    • getModelFolder

      public static String getModelFolder(String modelname)
      Get the model folder - create it if it doesn't exist.
      Parameters:
      modelname - - the name of the model - this is used to create the local folder name.
      Returns:
      file object for new folder
    • getNumDownloadListeners

      public int getNumDownloadListeners()
      Get the number of download listeners.
      Returns:
      the number of download listeners.
    • addDownloadListener

      public boolean addDownloadListener(DLDownloadListener e)
      Add a download listener to the array manager.
      Parameters:
      e - - the listener to add.
      Returns:
      true if the listener was added successfully.
    • removeDownladListener

      public boolean removeDownladListener(Object o)
      Remove a download listener to the array manager.
      Parameters:
      e - - the listener to remove.
      Returns:
      true if the listener was removed successfully.
    • main

      public static void main(String[] args)
    • clearDownloadListeners

      public void clearDownloadListeners()