Load .st as relative file name relative to root by prefix.
(String prefix, String unqualifiedFileName)
| 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() { |
no test coverage detected