@Override public Reader getReader(String templateName) { // append the prefix and make sure prefix ends with a separator character StringBuilder path = new StringBuilder(128); if (this.getPrefix() != null) { path.append(this.getPrefix()); // we do NOT use OS dependent separators here; getResourceAsStream // explicitly requires forward slashes. if (!this.getPrefix().endsWith(Character.toString(this.expectedSeparator))) { path.append(this.expectedSeparator); } } path.append(templateName); if (this.getSuffix() != null) { path.append(this.getSuffix()); } String location = path.toString(); logger.debug("Looking for template in {}.", location); // perform the lookup InputStream is = this.rcl.getResourceAsStream(location); if (is == null) { throw new LoaderException(null, "Could not find template \"" + location + "\""); } try { return new BufferedReader(new InputStreamReader(is, this.charset)); } catch (UnsupportedEncodingException e) { } return null; }
@Override public Reader getReader(String templateName) { // append the prefix and make sure prefix ends with a separator character StringBuilder path = new StringBuilder(128); if (this.getPrefix() != null) { path.append(this.getPrefix()); // we do NOT use OS dependent separators here; getResourceAsStream // explicitly requires forward slashes. if (!this.getPrefix().endsWith(Character.toString(this.expectedSeparator))) { path.append(this.expectedSeparator); } } path.append(templateName); if (this.getSuffix() != null) { path.append(this.getSuffix()); } String location = path.toString(); logger.debug("Looking for template in {}.", location); // perform the lookup InputStream is = this.rcl.getResourceAsStream(location); if (is == null) { throw new LoaderException(null, "Could not find template \"" + location + "\""); } try { return new BufferedReader(new InputStreamReader(is, this.charset)); } catch (UnsupportedEncodingException e) { } return null; }