Package com.atlassian.bamboo.utils
Class BambooPathUtils
java.lang.Object
com.atlassian.bamboo.utils.BambooPathUtils
Provides functionality equivalent to Apache FileUtils, but on
Path
s. Do not add methods that do not exist in Apache class to this class,
use BambooFiles
instead.
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
cleanDirectory
(@NotNull Path directoryToCleanOrSymlink) static boolean
contentEquals
(@NotNull Path file1, @NotNull Path file2) static void
deleteDirectory
(@NotNull Path path) static boolean
deleteQuietly
(@Nullable Path path) static void
forceDelete
(@NotNull Path path) static OutputStream
openOutputStream
(Path file) static OutputStream
openOutputStream
(Path file, boolean append) static String
readFileToString
(Path path, Charset encoding) static @Nullable Path
static Path
toRealPathIfNeeded
(@NotNull Path maybeSymlink) Returns a fully dereferenced path (including hardlinks) if the supplied argument is a symlink.static void
writeStringToFile
(Path file, String data, Charset charset)
-
Constructor Details
-
BambooPathUtils
public BambooPathUtils()
-
-
Method Details
-
deleteQuietly
- See Also:
-
FileUtils.deleteQuietly(File)
-
cleanDirectory
public static void cleanDirectory(@NotNull @NotNull Path directoryToCleanOrSymlink) throws IOException - Throws:
IOException
- See Also:
-
FileUtils.cleanDirectory(File)
-
deleteDirectory
- Throws:
IOException
- See Also:
-
FileUtils.deleteDirectory(File)
-
forceDelete
- Throws:
IOException
- See Also:
-
FileUtils.forceDelete(File)
-
toRealPathIfNeeded
Returns a fully dereferenced path (including hardlinks) if the supplied argument is a symlink.- Throws:
IOException
-
writeStringToFile
- Throws:
IOException
-
toPath
-
openOutputStream
- Throws:
IOException
-
openOutputStream
- 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
- Throws:
IOException
- See Also:
-
FileUtils.readFileToString(File, Charset)
-