如何使用jackson创建类似于下面示例的json数组.
我尝试使用ObjectMapper,但这似乎不正确.
try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
for (Path file : ds) {
System.out.println("name:"+file.getFileName()+
"\n"+
"mime:"+Files.probeContentType(file)+
"\n"+
"locked:"+!Files.isWritable(file));
}
} catch (IOException e) {
System.err.println(e);
}
Run Code Online (Sandbox Code Playgroud)
最终我将制作一个具有以下值的json.
* - (int) size file size in b. required
* - (int) ts file modification time in unix time. required
* - (string) mime mimetype. required for folders, others - optionally
* - (bool) read read permissions. required
* - (bool) write write permissions. required
* - (bool) locked is object locked. …
Run Code Online (Sandbox Code Playgroud)