public class PathMover extends Object
Constructor and Description |
---|
PathMover(Path src,
Path target,
CopyOption[] options)
构造
|
Modifier and Type | Method and Description |
---|---|
Path |
move()
移动文件或目录到目标中,例如:
如果src和target为同一文件或目录,直接返回target。
|
Path |
moveContent()
移动文件或目录内容到目标中,例如:
如果src为文件,target为目录,则移动到目标目录下,存在同名文件则按照是否覆盖参数执行。
|
static PathMover |
of(Path src,
Path target,
boolean isOverride)
创建文件或目录移动器
|
static PathMover |
of(Path src,
Path target,
CopyOption[] options)
创建文件或目录移动器
|
public PathMover(Path src, Path target, CopyOption[] options)
src
- 源文件或目录,不能为null
且必须存在target
- 目标文件或目录options
- 移动参数public static PathMover of(Path src, Path target, boolean isOverride)
src
- 源文件或目录target
- 目标文件或目录isOverride
- 是否覆盖目标文件PathMover
public static PathMover of(Path src, Path target, CopyOption[] options)
src
- 源文件或目录target
- 目标文件或目录options
- 移动参数PathMover
public Path move()
IllegalArgumentException
public Path moveContent()
IllegalArgumentException
Copyright © 2024. All rights reserved.