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, |
| 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() { |
no test coverage detected