public class PathBaseDirBuilder extends Object implements BaseDirBuilder
BaseDirBuilder
that is based on an initial Path
.Constructor and Description |
---|
PathBaseDirBuilder(File baseDir)
Constructor.
|
PathBaseDirBuilder(Path baseDir)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Path |
build()
Build the baseDir.
|
void |
close()
If the path backing this build is not from the default file system, its file system will be closed.
|
Path |
dir(String path)
Creates a directory at the given path within the base dir.
|
Path |
file(String path)
Returns a path for the given path within the base dir.
|
Path |
file(String path,
String content)
Creates a file with the given string content at the given path within the base dir.
|
public PathBaseDirBuilder(File baseDir)
baseDir
- used to call this(baseDir.toPath())
public Path file(String path)
All parent directories will be created on demand.
file
in interface BaseDirBuilder
path
- The relative path to the pathpublic Path file(String path, String content)
All parent directories will be created on demand.
file
in interface BaseDirBuilder
path
- The relative path to the file to createcontent
- The content to write to the filepublic Path dir(String path)
All parent directories will be created on demand.
dir
in interface BaseDirBuilder
path
- The relative path to the file to createpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- If the build could not be closed cleanlypublic Path build()
build
in interface BaseDirBuilder