Class ExternalFile

java.lang.Object
fr.flowarg.flowupdater.download.json.ExternalFile

public class ExternalFile extends Object
This class represents an external file object.
  • Constructor Details

    • ExternalFile

      public ExternalFile(String path, String downloadURL, String sha1, long size)
      Construct a new ExternalFile object.
      Parameters:
      path - Path of external file.
      sha1 - Sha1 of external file.
      size - Size of external file.
      downloadURL - external file URL.
    • ExternalFile

      public ExternalFile(String path, String downloadURL, String sha1, long size, boolean update)
      Construct a new ExternalFile object.
      Parameters:
      path - Path of external file.
      sha1 - Sha1 of external file.
      size - Size of external file.
      downloadURL - external file URL.
      update - false: not checking if the file is valid. true: checking if the file is valid.
  • Method Details

    • getExternalFilesFromJson

      @NotNull public static @NotNull List<ExternalFile> getExternalFilesFromJson(URL jsonUrl)
      Provide a List of external file from a JSON file. Template of a JSON file :
       {
         "extfiles": [
           {
             "path": "other/path/AnExternalFile.binpatch",
             "downloadURL": "https://url.com/launcher/extern/AnExtFile.binpatch",
             "sha1": "40f784892989du0fc6f45c895d4l6c5db9378f48",
             "size": 25652
           },
           {
             "path": "config/config.json",
             "downloadURL": "https://url.com/launcher/ext/modconfig.json",
             "sha1": "eef74b3fbab6400cb14b02439cf092cca3c2125c",
             "size": 19683,
             "update": false
           }
         ]
       }
       
      Parameters:
      jsonUrl - the JSON file URL.
      Returns:
      an external file list.
    • getExternalFilesFromJson

      @NotNull public static @NotNull List<ExternalFile> getExternalFilesFromJson(String jsonUrl)
      Provide a List of external file from a JSON file.
      Parameters:
      jsonUrl - the JSON file URL.
      Returns:
      an external file list.
    • getPath

      public String getPath()
      Get the path of the external file.
      Returns:
      the path of the external file.
    • getDownloadURL

      public String getDownloadURL()
      Get the url of the external file.
      Returns:
      the url of the external file.
    • getSha1

      public String getSha1()
      Get the sha1 of the external file.
      Returns:
      the sha1 of the external file.
    • getSize

      public long getSize()
      Get the size of the external file.
      Returns:
      the size of the external file.
    • isUpdate

      public boolean isUpdate()
      Should ExternalFileDeleter check the file?
      Returns:
      if the external file deleter should check and delete the file.