Package com.atlassian.confluence.util.io
Class ConfluenceFileUtils
java.lang.Object
com.atlassian.confluence.util.io.ConfluenceFileUtils
Utilities that patch/extend Atlassian Core FileUtils.
TODO: Migrate these out of confluence, into a common module
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
extractFileName
(String pathname) extractFileName extracts the name of the filestatic boolean
Determine if a file is a child of anotherstatic void
move a directory with all it's children into another directory if destination directory already exists, it will be deleted.static void
moveDirWithCopyFallback
(io.atlassian.fugue.Either<AttachmentRef, AttachmentRef.Container> container, File srcDir, File destDir, DeferredFileDeletionQueue deferredFileDeletionQueue) CallsmoveDir(java.io.File, java.io.File)
to move the directory.static void
moveDirWithCopyFallback
(File srcDir, File destDir, DeferredFileDeletionQueue deferredFileDeletionQueue) CallsmoveDir(java.io.File, java.io.File)
to move the directory.
-
Constructor Details
-
ConfluenceFileUtils
public ConfluenceFileUtils()
-
-
Method Details
-
moveDir
move a directory with all it's children into another directory if destination directory already exists, it will be deleted.Retries a move once, after a short delay, if the move cannot complete for some reason. e.g. rename c:/foo/bar to c:/fooz/bar
- Throws:
IOException
-
moveDirWithCopyFallback
public static void moveDirWithCopyFallback(io.atlassian.fugue.Either<AttachmentRef, AttachmentRef.Container> container, File srcDir, File destDir, DeferredFileDeletionQueue deferredFileDeletionQueue) throws IOExceptionCallsmoveDir(java.io.File, java.io.File)
to move the directory. If that fails, it falls back to copying the source directory to the destination directory.- Parameters:
container
- the information of containersrcDir
- the directory to copydestDir
- the location to copy to - it will be created if it does not existdeferredFileDeletionQueue
-- Throws:
IOException
- when the move or copy operations fail.
-
moveDirWithCopyFallback
public static void moveDirWithCopyFallback(File srcDir, File destDir, DeferredFileDeletionQueue deferredFileDeletionQueue) throws IOException CallsmoveDir(java.io.File, java.io.File)
to move the directory. If that fails, it falls back to copying the source directory to the destination directory.- Parameters:
srcDir
- the directory to copydestDir
- the location to copy to - it will be created if it does not existdeferredFileDeletionQueue
-- Throws:
IOException
- when the move or copy operations fail.
-
isChildOf
Determine if a file is a child of another- Parameters:
dir
- the directory to checkchild
- the child to find
-
extractFileName
extractFileName extracts the name of the file- Parameters:
pathname
- - file pathname- Returns:
- file name, without the path
- Since:
- 7.0.0
-