update the index file content: if new file then add while old file will be updated content is a big easy (key val directly) json like this: { ".\\doc\\OptionsAndParameters2.png": "f4a36c21ce890b0fa10067c10dab416e9b71a13e" }
(List<String> files)
| 44 | * } |
| 45 | */ |
| 46 | private void addFiles(List<String> files) { |
| 47 | final String indexContent = FileUtil.getFileAsString(ConstantVal.INDEX, ConstantVal.NONE); |
| 48 | final JsonObject asJsonObject = new Gson().fromJson(indexContent, JsonObject.class); |
| 49 | |
| 50 | files.forEach(file -> { |
| 51 | final boolean isFile = FileUtil.isFile(file); |
| 52 | if (isFile) { |
| 53 | addFile(asJsonObject, file); |
| 54 | } else { // is directory |
| 55 | addDirectory(asJsonObject, file); |
| 56 | } |
| 57 | }); |
| 58 | FileUtil.createFile(asJsonObject.toString(), ConstantVal.INDEX); |
| 59 | } |
| 60 | |
| 61 | private void addFile(JsonObject asJsonObject, String file) { |
| 62 | HashObject hashObject = new HashObject(); |
no test coverage detected