Here you can find the source of loadTemplate(String templateUrl)
private static String loadTemplate(String templateUrl) throws IOException
//package com.java2s; /*/* ww w.ja v a2 s. com*/ * Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Amazon Software License (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/asl/ * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private static String loadTemplate(String templateUrl) throws IOException { try (InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(templateUrl)) { if (input == null) { throw new IOException("Could not find template at location: " + templateUrl); } try (BufferedReader reader = new BufferedReader(new InputStreamReader(input))) { StringBuilder stringBuilder = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { stringBuilder.append(line).append("\n"); } return stringBuilder.toString(); } } } }