Package com.atlassian.bamboo.utils
Class BambooPathUtils
- java.lang.Object
-
- com.atlassian.bamboo.utils.BambooPathUtils
-
public class BambooPathUtils extends Object
Provides functionality equivalent to Apache FileUtils, but onPaths. Do not add methods that do not exist in Apache class to this class, useBambooFilesinstead. Any change to this class should pass a full suite of Apache Commons IO unit tests. See https://hello.atlassian.net/wiki/spaces/BAMBOO/pages/141524177/Testing+BambooPathUtils+against+Apache+Commons+IO+unit+tests for details
-
-
Constructor Summary
Constructors Constructor Description BambooPathUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcleanDirectory(@NotNull Path directoryToCleanOrSymlink)static booleancontentEquals(@NotNull Path file1, @NotNull Path file2)static voiddeleteDirectory(@NotNull Path path)static booleandeleteQuietly(@Nullable Path path)static voidforceDelete(@NotNull Path path)static OutputStreamopenOutputStream(Path file)static OutputStreamopenOutputStream(Path file, boolean append)static StringreadFileToString(Path path, Charset encoding)static @Nullable PathtoPath(@Nullable File file)static PathtoRealPathIfNeeded(@NotNull Path maybeSymlink)Returns a fully dereferenced path (including hardlinks) if the supplied argument is a symlink.static voidwriteStringToFile(Path file, String data, Charset charset)
-
-
-
Method Detail
-
deleteQuietly
public static boolean deleteQuietly(@Nullable @Nullable Path path)- See Also:
FileUtils.deleteQuietly(File)
-
cleanDirectory
public static void cleanDirectory(@NotNull @NotNull Path directoryToCleanOrSymlink) throws IOException- Throws:
IOException- See Also:
FileUtils.cleanDirectory(File)
-
deleteDirectory
public static void deleteDirectory(@NotNull @NotNull Path path) throws IOException- Throws:
IOException- See Also:
FileUtils.deleteDirectory(File)
-
forceDelete
public static void forceDelete(@NotNull @NotNull Path path) throws IOException- Throws:
IOException- See Also:
FileUtils.forceDelete(File)
-
toRealPathIfNeeded
public static Path toRealPathIfNeeded(@NotNull @NotNull Path maybeSymlink) throws IOException
Returns a fully dereferenced path (including hardlinks) if the supplied argument is a symlink.- Throws:
IOException
-
writeStringToFile
public static void writeStringToFile(Path file, String data, Charset charset) throws IOException
- Throws:
IOException
-
openOutputStream
public static OutputStream openOutputStream(Path file) throws IOException
- Throws:
IOException
-
openOutputStream
public static OutputStream openOutputStream(Path file, boolean append) throws IOException
- Throws:
IOException
-
contentEquals
public static boolean contentEquals(@NotNull @NotNull Path file1, @NotNull @NotNull Path file2) throws IOException- Throws:
IOException- See Also:
FileUtils.contentEquals(File, File)
-
readFileToString
public static String readFileToString(Path path, Charset encoding) throws IOException
- Throws:
IOException- See Also:
FileUtils.readFileToString(File, Charset)
-
-