[DRAFT] Abstract file tree with several implementations.
This library defines universal INode interface and provides some implementations for this interface:
- FileNode - standard filesystem node based on
java.io.File
.
import pl.mjaron.datanode;
public class Sample {
public static void main(String[] args) {
final String sentence = "Hello world\nByeWorld.";
final INode root = new FileNode("root_dir");
root
.getChild("subdirectory").mkdirs()
.getChild("file.txt").remove().touch()
.write(sentence);
final String checkedContent = new FileNode("root_dir/subdirectory/file.txt").readString();
Assertions.assertEquals(sentence, checkedContent);
}
}
dependencies {
implementation 'io.github.mjfryc:mjaron-datanode-java:1.0.0'
}
Click the Packages section on the right.
- Click the Packages section on the right.
- Find and download jar package from files list to e.g.
your_project_root/libs
dir. - Add this jar to project dependencies in build.gradle, e.g:
implementation files(project.rootDir.absolutePath + '/libs/mjaron-datanode-java-1.0.0.jar')