@Override
    public Optional<TemplateContentData> load(String responseTemplateName, Input input) throws TemplateLoaderException {
        TemplateEnumerator templateEnumerator = templateEnumeratorSupplier.apply(responseTemplateName, input);
        while (templateEnumerator.hasNext()) {
            String templateName = (String) templateEnumerator.next();
            String templatePath = buildCompletePath(templateName);
            try {
                URI templateUri = getResourceURI(templatePath);
                if (templateUri != null) {
                    String templateIdentifier = templateUri.toString();
                    TemplateContentData templateContentData = templateCache.get(templateIdentifier);
                    if (templateContentData == null) {
                        try (InputStream inputStream = getTemplateAsStream(templatePath)) {
                            byte[] templateByteArray = new byte[inputStream.available()];
                            inputStream.read(templateByteArray);
                            templateContentData = TemplateContentData.builder()
                                    .withIdentifier(templateIdentifier)
                                    .withTemplateContent(templateByteArray)
                                    .withTemplateBaseDir(directoryPath)
                                    .build();
                        } catch (IOException e) {
                            String message = String.format("Fail to read template file: %s with error: %s", templatePath, e.getMessage());
                            LOGGER.error(message);
                            throw new TemplateLoaderException(message);
                        }
                        templateCache.put(templateIdentifier, templateContentData);
                    }
                    return Optional.of(templateContentData);
                }
            } catch (URISyntaxException e) {
                String message = String.format("Cannot get valid URI for template file path: %s with error: %s", templatePath, e.getMessage());
                LOGGER.error(message);
                throw new TemplateLoaderException(message);
            }
        }
        String message = String.format("Cannot find template file: %s given directory path: %s and file extension: %s, returning empty.",
                responseTemplateName, directoryPath, fileExtension);
        LOGGER.warn(message);
        return Optional.empty();
    }
@ Override public Optional < TemplateContentData > load ( String responseTemplateName , Input input ) throws TemplateLoaderException { TemplateEnumerator templateEnumerator = templateEnumeratorSupplier . apply ( responseTemplateName , input ) ; while ( templateEnumerator . hasNext ( ) ) { String templateName = ( String ) templateEnumerator . next ( ) ; String templatePath = buildCompletePath ( templateName ) ; try { URI templateUri = getResourceURI ( templatePath ) ; if ( templateUri != null ) { String templateIdentifier = templateUri . toString ( ) ; TemplateContentData templateContentData = templateCache . get ( templateIdentifier ) ; if ( templateContentData == null ) { try ( InputStream inputStream = getTemplateAsStream ( templatePath ) ) { byte [ ] templateByteArray = new byte [ inputStream . available ( ) ] ; inputStream . read ( templateByteArray ) ; templateContentData = TemplateContentData . builder ( ) . withIdentifier ( templateIdentifier ) . withTemplateContent ( templateByteArray ) . withTemplateBaseDir ( directoryPath ) . build ( ) ; } catch ( IOException e ) { String message = String . format ( "Fail to read template file: %s with error: %s" , templatePath , e . getMessage ( ) ) ; LOGGER . error ( message ) ; throw new TemplateLoaderException ( message ) ; } templateCache . put ( templateIdentifier , templateContentData ) ; } return Optional . of ( templateContentData ) ; } } catch ( URISyntaxException e ) { String message = String . format ( "Cannot get valid URI for template file path: %s with error: %s" , templatePath , e . getMessage ( ) ) ; LOGGER . error ( message ) ; throw new TemplateLoaderException ( message ) ; } } String message = String . format ( "Cannot find template file: %s given directory path: %s and file extension: %s, returning empty." , responseTemplateName , directoryPath , fileExtension ) ; LOGGER . warn ( message ) ; return Optional . empty ( ) ; }
{@inheritDoc}

Load template file content from local file system, using {@link TemplateEnumerator} and {@link TemplateCache}.