File Utilities
Various utilities for working with files, such as getting file hashes or the minecraft root directory
Introduction
A fully functional Version of this class has first been introduced in Version 2.1.0
(Before SI: Essentials 2.3.0 known as FileHashUtils)
The File Hash Utilities class allows you get the SHA256 file hash / checksum of a file as a String.
Class
File: FileUtils.java
Package: dev.soncresityindustries.es.api.v0.util
Methods
getSHA256Checksum
public static String getSHA256Checksum(@NotNull File file) throws IOException, NoSuchAlgorithmException {}Returns the SHA256 checksum of a file as a String. This can be used to check whether a file has been modified or to compare two files.
Usage
String hash = FileHashUtils.getSHA256Checksum(file);getGameDir
public static Path getGameDir() {}Returns the Minecraft root directory as a Path. This can be used to access files in the Minecraft directory.
Usage
Path mcDir = FileUtils.getGameDir();