java.lang.Object
page.codeberg.friedolyn.meta.Downloadable
- Direct Known Subclasses:
PolledMetadata,UserAgentManager
Represents a file or other resource that can be fetched from a remote location, such as a web server.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleandownload()Fetches the resource represented by the object from the remote location that it is available at.static booleanwasDownloadedWithin(String dateTimeLastDownload, @NonNull Duration duration) Checks if the date and time of the last download is within the specified duration from (until) now.abstract booleanwasDownloadedWithin(@NonNull Duration duration) Checks if the resource represented by the object was downloaded more recently than the specified duration, i.e.
-
Constructor Details
-
Downloadable
public Downloadable()
-
-
Method Details
-
download
public abstract boolean download()Fetches the resource represented by the object from the remote location that it is available at.- Returns:
trueif the download was successful,falseotherwise.
-
wasDownloadedWithin
Checks if the resource represented by the object was downloaded more recently than the specified duration, i.e. whether the resource was downloaded within `now - duration`.- Parameters:
duration- The time between the oldest acceptable download date and now.- Returns:
trueif the resource was downloaded within the specified duration,falseotherwise.
-
wasDownloadedWithin
public static boolean wasDownloadedWithin(String dateTimeLastDownload, @NonNull @NonNull Duration duration) Checks if the date and time of the last download is within the specified duration from (until) now.- Parameters:
dateTimeLastDownload- The date and time of the last download in a format that can be parsed byLocalDateTime.parse(CharSequence).duration- The time between the oldest acceptable download date and now.- Returns:
trueif the resource was downloaded within the specified duration,falseotherwise.Falseif the date and time of the last download could not be parsed or could not becompared with the current date and time.
-