aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/template/TemplateFile.java
blob: 402d7f8c5e592d0ca9065a941d37476a45b8353a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.task.util.template;

import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixPath;

import java.nio.file.Path;

/**
 * Parses a template file, see {@link Template} for details.
 *
 * @author hakonhall
 */
public class TemplateFile {
    public static Template read(Path path) { return read(path, new TemplateDescriptor()); }

    public static Template read(Path path, TemplateDescriptor descriptor) {
        String content = new UnixPath(path).readUtf8File();
        return TemplateParser.parse(descriptor, content);
    }
}