class TemplateFileReader {

    public byte[] readTemplate(final String templatesName) {
        byte[] result;
        Map<String, byte[]> templatesMap = resourceHolder.getTemplates();
        if (templatesMap.containsKey(templatesName)) {
            result = templatesMap.get(templatesName);
        } else {
            result = readTemplateFromFileSystem(templatesName);
            resourceHolder.addTemplate(templatesName, result);
        }
        return result;
    }

}