1 34 package groovy.text; 35 36 import java.io.File ; 37 import java.io.FileNotFoundException ; 38 import java.io.FileReader ; 39 import java.io.IOException ; 40 import java.io.InputStreamReader ; 41 import java.io.Reader ; 42 import java.io.StringReader ; 43 import java.net.URL ; 44 45 import org.codehaus.groovy.control.CompilationFailedException; 46 47 52 public abstract class TemplateEngine { 53 public abstract Template createTemplate(Reader reader) throws CompilationFailedException, ClassNotFoundException , IOException ; 54 55 public Template createTemplate(String templateText) throws CompilationFailedException, FileNotFoundException , ClassNotFoundException , IOException { 56 return createTemplate(new StringReader (templateText)); 57 } 58 59 public Template createTemplate(File file) throws CompilationFailedException, FileNotFoundException , ClassNotFoundException , IOException { 60 return createTemplate(new FileReader (file)); 61 } 62 63 public Template createTemplate(URL url) throws CompilationFailedException, ClassNotFoundException , IOException { 64 return createTemplate(new InputStreamReader (url.openStream())); 65 } 66 } 67 | Popular Tags |