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