diff options
author | toby <smorgrav@yahoo-inc.com> | 2018-04-17 15:07:27 +0200 |
---|---|---|
committer | toby <smorgrav@yahoo-inc.com> | 2018-04-18 14:14:42 +0200 |
commit | 8cdb9b19ea421c7373f4a086a28cb3c90c2b53c5 (patch) | |
tree | b39bb2850900bc772fce093aa19e2a0197899332 | |
parent | 3176670169311418a858294b8e5d6dee3d062419 (diff) |
Keep editor javadoc for files
-rw-r--r-- | node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Editor.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Editor.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Editor.java index 3d4dbcca0e6..ebc432ccd5f 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Editor.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/Editor.java @@ -31,21 +31,25 @@ public class Editor { private final String name; private final LineEditor editor; + /** + * Read the file which must be encoded in UTF-8, use the LineEditor to edit it, + * and any modifications were done write it back and return true. + */ public Editor(Path path, LineEditor editor) { this(path.toString(), () -> uncheck(() -> Files.readAllLines(path, ENCODING)), - (newLines) -> uncheck(() -> Files.write(path, newLines, ENCODING)), + (newLines) -> uncheck(() -> Files.write(path, newLines, ENCODING)), editor); } /** - * @param name The name of what is being edited - used in logging + * @param name The name of what is being edited - used in logging * @param supplier Supplies the editor with a list of lines to edit * @param consumer Consumes the lines to presist if any changes is detected - * @param editor The line operations to execute on the lines supplied + * @param editor The line operations to execute on the lines supplied */ public Editor(String name, - Supplier<List<String>> supplier, + Supplier<List<String>> supplier, Consumer<List<String>> consumer, LineEditor editor) { this.supplier = supplier; @@ -76,7 +80,8 @@ public class Editor { case NONE: newLines.add(line); break; - default: throw new IllegalArgumentException("Unknown EditType " + edit.getType()); + default: + throw new IllegalArgumentException("Unknown EditType " + edit.getType()); } if (!edit.appendLines().isEmpty()) { |