Package ng.packaging
Class Util
java.lang.Object
ng.packaging.Util
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyContentsOfDirectoryToDirectory(Path sourceDirectory, Path destinationDirectory) Copy the contents of the directory specified by [sourceDirectory] into the directory specified by [destinationDirectory], maintaining the directory tree/hierarchy.static voidcopyContentsOfDirectoryToDirectoryFlatten(Path sourceDirectory, Path destinationDirectory, Collection<String> directorySuffixesToNotFlatten) Copy files in the directory specified by [sourceDirectory] into the directory specified by [destinationDirectory], not maintaining the hierarchy, i.e.static voidcopyContentsOfFolderAtPathToFolderInJar(Path sourcePath, String folderName, Path destinationJarPath) Writes the contents of the folder specified by [sourcePath] into a folder named [folder] in the root of [destinationJarPath] - Does nothing if the folder specified by sourcePath does not exist - Creates the destination folder if missing.static voidcopyFile(Path sourcePath, Path destinationPath, CopyOption... options) Copy the file at [sourcePath] to a new file specified by [destinationPath] This method exists solely to wrap the checked IOException in an UncheckedIOExceptionstatic voidcopyFolderFromJarToPath(String folderName, Path sourceJarPath, Path destinationPath) Copies the folder specified by folderName to destinationPath.static Pathstatic booleanjarContainsNonEmptyWebServerResourcesDirectoryInRoot(File sourceJarFile) static voidmakeUserExecutable(Path path) static StringreadTemplate(String name) static voidwriteStringToPath(String string, Path path) Writes [string] to a file specified by [path]static voidwriteStringToPathInJar(String string, String destinationFilePathInsideJar, Path destinationJarPath) Writes the contents of the folder specified by [sourcePath] into a folder named [folder] in the root of [destinationJarPath] Creates the folder in question if missing.
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
copyFile
Copy the file at [sourcePath] to a new file specified by [destinationPath] This method exists solely to wrap the checked IOException in an UncheckedIOException -
copyContentsOfDirectoryToDirectory
public static void copyContentsOfDirectoryToDirectory(Path sourceDirectory, Path destinationDirectory) Copy the contents of the directory specified by [sourceDirectory] into the directory specified by [destinationDirectory], maintaining the directory tree/hierarchy. -
copyContentsOfDirectoryToDirectoryFlatten
public static void copyContentsOfDirectoryToDirectoryFlatten(Path sourceDirectory, Path destinationDirectory, Collection<String> directorySuffixesToNotFlatten) Copy files in the directory specified by [sourceDirectory] into the directory specified by [destinationDirectory], not maintaining the hierarchy, i.e. "flattening" the structure. Directories with names ending with [directorySuffixesToNotFlatten] are considered "bundles", i.e. they're essentially treated like files and copied in their entirety. -
writeStringToPath
Writes [string] to a file specified by [path] -
readTemplate
-
makeUserExecutable
-
jarContainsNonEmptyWebServerResourcesDirectoryInRoot
- Returns:
- true if [sourceJarFile] contains a non-empty WebServerResources-directory in it's root
-
copyFolderFromJarToPath
public static void copyFolderFromJarToPath(String folderName, Path sourceJarPath, Path destinationPath) Copies the folder specified by folderName to destinationPath. Copies the entire folder, not just the content (as in, you will end up with [destinationPath]/[folderName]/... FIXME: Don't copy the folder if it's empty // Hugi 2021-08-07 -
copyContentsOfFolderAtPathToFolderInJar
public static void copyContentsOfFolderAtPathToFolderInJar(Path sourcePath, String folderName, Path destinationJarPath) Writes the contents of the folder specified by [sourcePath] into a folder named [folder] in the root of [destinationJarPath] - Does nothing if the folder specified by sourcePath does not exist - Creates the destination folder if missing. FIXME: This method currently silently overwrites existing files in the jar. We probably want to be more intelligent about that // Hugi 2022-09-28 -
writeStringToPathInJar
public static void writeStringToPathInJar(String string, String destinationFilePathInsideJar, Path destinationJarPath) Writes the contents of the folder specified by [sourcePath] into a folder named [folder] in the root of [destinationJarPath] Creates the folder in question if missing. FIXME: Should this overwrite existing files silently or fail on overwrite? // Hugi 2021-07-14 FIXME: Don't accept a string for the destination parameter, use a path if possible. // Hugi 2021-07-14 -
folder
- Returns:
- The folder at the given path. Creates the folder if missing, throws an exception if the path exists but is not a folder.
-