class WebApplicationTemplateResource implements ITemplateResource {


    private final IWebApplication webApplication;
    private final String path;
    private final String characterEncoding;



    public WebApplicationTemplateResource(final IWebApplication webApplication, final String path, final String characterEncoding) {

        super();

        Validate.notNull(webApplication, "Web Application object cannot be null");
        Validate.notEmpty(path, "Resource Path cannot be null or empty");
        // Character encoding CAN be null (system default will be used)

        this.webApplication = webApplication;
        final String cleanPath = TemplateResourceUtils.cleanPath(path);
        this.path = (cleanPath.charAt(0) != '/' ? ("/" + cleanPath) : cleanPath);
        this.characterEncoding = characterEncoding;

    }




    public String getDescription() {
        return this.path;
    }




    public String getBaseName() {
        return TemplateResourceUtils.computeBaseName(this.path);
    }




    public Reader reader() throws IOException {<FILL_FUNCTION_BODY>}




    public ITemplateResource relative(final String relativeLocation) {

        Validate.notEmpty(relativeLocation, "Relative Path cannot be null or empty");

        final String fullRelativeLocation = TemplateResourceUtils.computeRelativeLocation(this.path, relativeLocation);
        return new WebApplicationTemplateResource(this.webApplication, fullRelativeLocation, this.characterEncoding);

    }




    public boolean exists() {
        return this.webApplication.resourceExists(this.path);
    }


}


        final InputStream inputStream = this.webApplication.getResourceAsStream(this.path);
        if (inputStream == null) {
            throw new FileNotFoundException(String.format("Web Application resource \"%s\" does not exist", this.path));
        }

        if (!StringUtils.isEmptyOrWhitespace(this.characterEncoding)) {
            return new BufferedReader(new InputStreamReader(new BufferedInputStream(inputStream), this.characterEncoding));
        }

        return new BufferedReader(new InputStreamReader(new BufferedInputStream(inputStream)));

    
<no_super_class>