MCPcopy Index your code
hub / github.com/antlr/codebuff / loadTemplateFile

Method loadTemplateFile

output/java8/1.4.13/STGroupDir.java:151–172  ·  view source on GitHub ↗

Load .st as relative file name relative to root by prefix.

(String prefix, String unqualifiedFileName)

Source from the content-addressed store, hash-verified

149 /** Load .st as relative file name relative to root by {@code prefix}. */
150
151 public CompiledST loadTemplateFile(String prefix, String unqualifiedFileName) {
152 if ( verbose ) System.out.println("loadTemplateFile("+unqualifiedFileName+") in groupdir "+"from "+root+" prefix="+prefix);
153 URL f;
154 try {
155 f = new URL(root+prefix+unqualifiedFileName);
156 }
157 catch (MalformedURLException me) {
158 errMgr.runTimeError(null, null, ErrorType.INVALID_TEMPLATE_NAME, me, root+unqualifiedFileName);
159 return null;
160 }
161 ANTLRInputStream fs;
162 try {
163 fs = new ANTLRInputStream(f.openStream(), encoding);
164 fs.name = unqualifiedFileName;
165 }
166 catch (IOException ioe) {
167 if ( verbose ) System.out.println(root+"/"+unqualifiedFileName+" doesn't exist");
168 //errMgr.IOError(null, ErrorType.NO_SUCH_TEMPLATE, ioe, unqualifiedFileName);
169 return null;
170 }
171 return loadTemplateFile(prefix, unqualifiedFileName, fs);
172 }
173
174 @Override
175 public String getName() {

Callers 1

loadMethod · 0.95

Calls 2

runTimeErrorMethod · 0.65
openStreamMethod · 0.45

Tested by

no test coverage detected