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

Method loadTemplateFile

output/java8/1.4.17/STGroupDir.java:151–176  ·  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,
159 null,
160 ErrorType.INVALID_TEMPLATE_NAME,
161 me,
162 root+unqualifiedFileName);
163 return null;
164 }
165 ANTLRInputStream fs;
166 try {
167 fs = new ANTLRInputStream(f.openStream(), encoding);
168 fs.name = unqualifiedFileName;
169 }
170 catch (IOException ioe) {
171 if ( verbose ) System.out.println(root+"/"+unqualifiedFileName+" doesn't exist");
172 //errMgr.IOError(null, ErrorType.NO_SUCH_TEMPLATE, ioe, unqualifiedFileName);
173 return null;
174 }
175 return loadTemplateFile(prefix, unqualifiedFileName, fs);
176 }
177
178 @Override
179 public String getName() {

Callers 1

loadMethod · 0.95

Calls 2

runTimeErrorMethod · 0.65
openStreamMethod · 0.45

Tested by

no test coverage detected