public class PathBaseDirBuilder extends java.lang.Object implements BaseDirBuilder
BaseDirBuilder that is based on an initial Path.| Constructor and Description |
|---|
PathBaseDirBuilder(java.io.File baseDir)
Constructor.
|
PathBaseDirBuilder(java.nio.file.Path baseDir)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.nio.file.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.
|
java.nio.file.Path |
dir(java.lang.String path)
Creates a directory at the given path within the base dir.
|
java.nio.file.Path |
file(java.lang.String path)
Returns a path for the given path within the base dir.
|
java.nio.file.Path |
file(java.lang.String path,
java.lang.String content)
Creates a file with the given string content at the given path within the base dir.
|
public PathBaseDirBuilder(java.io.File baseDir)
baseDir - used to call this(baseDir.toPath())public PathBaseDirBuilder(java.nio.file.Path baseDir)
baseDir - The base dir for this builder (will be returned by build()public java.nio.file.Path file(java.lang.String path)
All parent directories will be created on demand.
file in interface BaseDirBuilderpath - The relative path to the pathpublic java.nio.file.Path file(java.lang.String path,
java.lang.String content)
All parent directories will be created on demand.
file in interface BaseDirBuilderpath - The relative path to the file to createcontent - The content to write to the filepublic java.nio.file.Path dir(java.lang.String path)
All parent directories will be created on demand.
dir in interface BaseDirBuilderpath - The relative path to the file to createpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOException - If the build could not be closed cleanlypublic java.nio.file.Path build()
build in interface BaseDirBuilder