public class BootstrapUtilities
extends java.lang.Object
Constructor and Description |
---|
BootstrapUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanDirectory(java.io.File directory)
Cleans a directory without deleting it.
|
static void |
copyFile(java.io.File in,
java.io.File out) |
static long |
crc(java.io.File jarFile) |
static void |
deleteDirectory(java.io.File directory)
Deletes a directory recursively.
|
static void |
forceDelete(java.io.File file) |
static java.io.File |
getJarParentFolder(java.io.File resourcesDir,
LaunchManifest.Module m,
LaunchManifest.Jar j)
Given the root of the cache/resources/ folder, returns the correct parent folder for a given jar file, right
before the specific CRC subfolders.
|
static java.lang.String |
md5(java.io.File file) |
static java.lang.String |
readFileAsString(java.io.File file) |
static java.lang.String |
sanitize(java.lang.String s)
Sanitizes a string to be compatible with filename / foldername requirements by replacing illegal chars with
underscores.
|
static java.io.File |
subdir(java.io.File parent,
java.lang.String child)
Returns a subdir and tries to create it if necessary.
|
static java.io.File |
subfile(java.io.File base,
java.lang.String... subDirs) |
static java.io.File |
subfile(java.io.File base,
java.lang.String filePath) |
static void |
writeStringToFile(java.lang.String string,
java.io.File file) |
public static java.io.File subdir(java.io.File parent, java.lang.String child) throws java.lang.Exception
java.lang.Exception
public static java.io.File getJarParentFolder(java.io.File resourcesDir, LaunchManifest.Module m, LaunchManifest.Jar j) throws java.lang.Exception
java.lang.Exception
public static java.lang.String sanitize(java.lang.String s)
public static long crc(java.io.File jarFile) throws java.io.IOException
java.io.IOException
public static java.lang.String md5(java.io.File file) throws java.io.IOException
java.io.IOException
public static void deleteDirectory(java.io.File directory) throws java.io.IOException
directory
- directory to deletejava.io.IOException
- in case deletion is unsuccessfulpublic static void cleanDirectory(java.io.File directory) throws java.io.IOException
directory
- directory to cleanjava.io.IOException
- in case cleaning is unsuccessfulpublic static void forceDelete(java.io.File file) throws java.io.IOException
java.io.IOException
public static java.io.File subfile(java.io.File base, java.lang.String filePath)
public static java.io.File subfile(java.io.File base, java.lang.String... subDirs)
public static void copyFile(java.io.File in, java.io.File out) throws java.io.IOException
java.io.IOException
public static java.lang.String readFileAsString(java.io.File file) throws java.io.IOException
java.io.IOException
public static void writeStringToFile(java.lang.String string, java.io.File file) throws java.io.IOException
java.io.IOException