A Java library whose goal is to make it easy to declare, create and retrieve elaborate structures of files and directories on and from a local file system.
The original purpose of the library was to aid in tests verifying code whose responsibility is to find or otherwise manipulate file system items but there is nothing preventing from using this library to easily manipulate such structures in production.
Defines a fluent API that exposes convenient factory method allowing to define structures in an intuitive, declarative way. For example, code:
import static com.ziemsky.fsstructure.FsStructure.*
...
Path testDir;
FsStructure fsStructure =
create(
file('topLevelFile'),
dir('topLevelDir.empty'),
dir('topLevelDir.withContent',
dir('nestedDir.empty'),
dir('nestedDir.withContent',
file('nestedFile.level2'),
),
file('nestedFile.level1'),
)
).saveIn(testDir)
...
...creates the following tree of files and folders under the path given by testDir
:
├── topLevelDir.empty/
├── topLevelDir.withContent/
│ ├── nestedDir.empty/
│ ├── nestedDir.withContent/
│ │ └── nestedFile.level2
│ └── nestedFile.level1
└── topLevelFile
To make interactions with file system structures easier by using more intuitive language than java.nio.file.Path
and java.io.File
.
In the main project's directory execute ./gradlew
with no arguments for description of key build tasks.
This project follows Semantic Versioning specification.
NOTE: THIS PROJECT IS A WORK IN PROGRESS AND IS IN VERY EARLY STAGE OF DEVELOPMENT - NOT READY FOR ACTUAL USE, YET.
All source code in this repository is licenced to use as specified in MIT licence.
The summary of the intention for allowed use of the code from this repository:
- Feel free to use it in any form (source code or binary) and for any purpose (personal use or commercial).
- Feel free to use entire files or snippets of the code with or without modifications or simply use it as examples to inspire your own solutions.
- You don't have to state my authorship in any way and you don't have to include any specific licence.
- Don't hold me responsible for any results of using this code.
For more details of this licence see:
- The LICENCE file included in this project.
- Licence section of opensource.org.