mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Add comments
This commit is contained in:
parent
ba79e26cbc
commit
53695d49d8
@ -173,8 +173,10 @@ public class FileDownloaderCache {
|
|||||||
if (cachedFiles != null) {
|
if (cachedFiles != null) {
|
||||||
synchronized (cachedFiles) {
|
synchronized (cachedFiles) {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
// Generate a pretty json
|
||||||
mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
final ObjectNode objectNode = mapper.createObjectNode();
|
final ObjectNode objectNode = mapper.createObjectNode();
|
||||||
|
// Generate a json {"files":[...{files_info}...]}
|
||||||
objectNode.putArray("files").addAll(
|
objectNode.putArray("files").addAll(
|
||||||
cachedFiles.values().stream()
|
cachedFiles.values().stream()
|
||||||
.map((v) -> mapper.convertValue(v, JsonNode.class))
|
.map((v) -> mapper.convertValue(v, JsonNode.class))
|
||||||
@ -184,6 +186,7 @@ public class FileDownloaderCache {
|
|||||||
if (Files.notExists(cachedFileInfo)) {
|
if (Files.notExists(cachedFileInfo)) {
|
||||||
Files.createDirectories(cachedFileInfo.getParent());
|
Files.createDirectories(cachedFileInfo.getParent());
|
||||||
}
|
}
|
||||||
|
// Write to cache.json
|
||||||
mapper.writeValue(cachedFileInfo.toFile(), objectNode);
|
mapper.writeValue(cachedFileInfo.toFile(), objectNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user