Package net.fabricmc.loom.util
Class DownloadUtil
java.lang.Object
net.fabricmc.loom.util.DownloadUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDelete the file along with the corresponding ETag, if it exists.static voiddownloadIfChanged(URL from, File to, org.gradle.api.logging.Logger logger)static voiddownloadIfChanged(URL from, File to, org.gradle.api.logging.Logger logger, boolean quiet)static StringtoNiceSize(long bytes)Format the given number of bytes as a more human readable string.
-
Constructor Details
-
DownloadUtil
public DownloadUtil()
-
-
Method Details
-
downloadIfChanged
public static void downloadIfChanged(URL from, File to, org.gradle.api.logging.Logger logger) throws IOException- Parameters:
from- The URL of the file to be downloadedto- The destination to be saved to, and compared against if it existslogger- The logger to print everything to, typically fromProject.getLogger()- Throws:
IOException- If an exception occurs during the process
-
downloadIfChanged
public static void downloadIfChanged(URL from, File to, org.gradle.api.logging.Logger logger, boolean quiet) throws IOException- Parameters:
from- The URL of the file to be downloadedto- The destination to be saved to, and compared against if it existslogger- The logger to print information to, typically fromProject.getLogger()quiet- Whether to only print warnings (whentrue) or everything- Throws:
IOException- If an exception occurs during the process
-
toNiceSize
Format the given number of bytes as a more human readable string.- Parameters:
bytes- The number of bytes- Returns:
- The given number of bytes formatted to kilobytes, megabytes or gigabytes if appropriate
-
delete
Delete the file along with the corresponding ETag, if it exists.- Parameters:
file- The file to delete.
-