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