Package utils.common
Class DirectoryStructureToJson
- java.lang.Object
-
- utils.common.DirectoryStructureToJson
-
public class DirectoryStructureToJson extends java.lang.ObjectTurns the file system of a directory to JSONInspired by https://gist.github.com/shaiful16/863e05c349e34aec6851b6d9f0bc0034
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDirectoryStructureToJson.Node
-
Constructor Summary
Constructors Constructor Description DirectoryStructureToJson()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.JsonNodeget(java.nio.file.Path base, boolean flatten)Turns the file system of the given directory to JSON.
-
-
-
Method Detail
-
get
public static com.fasterxml.jackson.databind.JsonNode get(java.nio.file.Path base, boolean flatten) throws java.io.IOExceptionTurns the file system of the given directory to JSON. It does NOT check access rights.- Parameters:
base- File object of the base directory.flatten- If true, the returned JSON will be a list of files (not nested, no directories). If false, the returned JSON will have a nested file structure.- Throws:
java.io.IOException
-
-